diff options
author | Ivan Zhakov <ivan@apache.org> | 2022-11-20 07:14:38 +0000 |
---|---|---|
committer | Ivan Zhakov <ivan@apache.org> | 2022-11-20 07:14:38 +0000 |
commit | 4f9b76b6f2acc4030ce9ef164322514c5d0e761b (patch) | |
tree | 9b993b3753affcbf164056826f9d568d8760b3a1 /misc | |
parent | 961caf5f46055483fa72ab02f5e8baa16c209e2f (diff) | |
download | apr-4f9b76b6f2acc4030ce9ef164322514c5d0e761b.tar.gz |
Remove trailing whitespaces in *.c.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc')
-rw-r--r-- | misc/netware/libprews.c | 2 | ||||
-rw-r--r-- | misc/netware/rand.c | 10 | ||||
-rw-r--r-- | misc/netware/start.c | 26 | ||||
-rw-r--r-- | misc/unix/errorcodes.c | 28 | ||||
-rw-r--r-- | misc/unix/getopt.c | 14 | ||||
-rw-r--r-- | misc/unix/otherchild.c | 6 | ||||
-rw-r--r-- | misc/unix/rand.c | 26 | ||||
-rw-r--r-- | misc/unix/start.c | 8 | ||||
-rw-r--r-- | misc/win32/apr_app.c | 2 | ||||
-rw-r--r-- | misc/win32/internal.c | 4 | ||||
-rw-r--r-- | misc/win32/misc.c | 18 | ||||
-rw-r--r-- | misc/win32/rand.c | 2 | ||||
-rw-r--r-- | misc/win32/utf8.c | 46 |
13 files changed, 96 insertions, 96 deletions
diff --git a/misc/netware/libprews.c b/misc/netware/libprews.c index 9f9db5c9c..d8562d6d5 100644 --- a/misc/netware/libprews.c +++ b/misc/netware/libprews.c @@ -61,7 +61,7 @@ int _NonAppStart WSADATA wsaData; #endif apr_status_t status; - + NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0); gLibId = register_library(DisposeLibraryData); diff --git a/misc/netware/rand.c b/misc/netware/rand.c index a2baae7ec..4d4b30598 100644 --- a/misc/netware/rand.c +++ b/misc/netware/rand.c @@ -33,7 +33,7 @@ static int NXSeedRandomInternal( size_t width, void *seed ) srand(NXGetSystemTick()); init = 1; } - + if (width > 3) { do @@ -42,21 +42,21 @@ static int NXSeedRandomInternal( size_t width, void *seed ) } while ((width -= 4) > 3); } - + if (width > 0) { char *p = (char *) s; u.x = rand(); - + while (width > 0) *p++ = u.y[width--]; } - + return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, +APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, apr_size_t length) { if (NXSeedRandom(length, buf) != 0) { diff --git a/misc/netware/start.c b/misc/netware/start.c index e044a1022..3522ba946 100644 --- a/misc/netware/start.c +++ b/misc/netware/start.c @@ -53,7 +53,7 @@ int (*WSACleanupWithNLMHandle)( void *handle ) = NULL; static int wsa_startup_with_handle (WORD wVersionRequested, LPWSADATA data, void *handle) { APP_DATA *app_data; - + if (!(app_data = (APP_DATA*) get_app_data(gLibId))) return APR_EGENERAL; @@ -63,18 +63,18 @@ static int wsa_startup_with_handle (WORD wVersionRequested, LPWSADATA data, void app_data->gs_event_rtag = AllocateResourceTag(handle, "WinSock Event", WS_WSAEVENT_SIGNATURE); app_data->gs_pcp_rtag = AllocateResourceTag(handle, "WinSock C-Port", WS_CPORT_SIGNATURE); - return WSAStartupRTags(wVersionRequested, data, - app_data->gs_startup_rtag, - app_data->gs_socket_rtag, - app_data->gs_lookup_rtag, - app_data->gs_event_rtag, + return WSAStartupRTags(wVersionRequested, data, + app_data->gs_startup_rtag, + app_data->gs_socket_rtag, + app_data->gs_lookup_rtag, + app_data->gs_event_rtag, app_data->gs_pcp_rtag); } static int wsa_cleanup_with_handle (void *handle) { APP_DATA *app_data; - + if (!(app_data = (APP_DATA*) get_app_data(gLibId))) return APR_EGENERAL; @@ -108,7 +108,7 @@ static int RegisterAppWithWinSock (void *nlm_handle) if (LOBYTE(wsaData.wVersion) != WSAHighByte || HIBYTE(wsaData.wVersion) != WSALowByte) { - + UnregisterAppWithWinSock (nlm_handle); return APR_EEXIST; } @@ -119,8 +119,8 @@ static int RegisterAppWithWinSock (void *nlm_handle) -APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, - const char * const * *argv, +APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, + const char * const * *argv, const char * const * *env) { /* An absolute noop. At present, only Win32 requires this stub, but it's @@ -143,9 +143,9 @@ APR_DECLARE(apr_status_t) apr_initialize(void) } /* apr_pool_initialize() is being called from the library - startup code since all of the memory resources belong + startup code since all of the memory resources belong to the library rather than the application. */ - + if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { return APR_ENOPOOL; } @@ -180,7 +180,7 @@ APR_DECLARE_NONSTD(void) apr_terminate(void) return; } - /* apr_pool_terminate() is being called from the + /* apr_pool_terminate() is being called from the library shutdown code since the memory resources belong to the library rather than the application */ diff --git a/misc/unix/errorcodes.c b/misc/unix/errorcodes.c index 08c7a31b7..1afd60823 100644 --- a/misc/unix/errorcodes.c +++ b/misc/unix/errorcodes.c @@ -170,17 +170,17 @@ static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) ULONG len; char *pos; int c; - + if (err >= 10000 && err < 12000) { /* socket error codes */ return stuffbuffer(buf, bufsize, strerror(apr_canonical_error(err+APR_OS_START_SYSERR))); - } + } else if (DosGetMessage(NULL, 0, message, HUGE_STRING_LEN, err, "OSO001.MSG", &len) == 0) { len--; message[len] = 0; pos = result; - + if (len >= sizeof(result)) len = sizeof(result) - 1; @@ -190,17 +190,17 @@ static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) c++; *(pos++) = apr_isspace(message[c]) ? ' ' : message[c]; } - + *pos = 0; - } + } else { sprintf(result, "OS/2 error %d", err); } - /* Stuff the string into the caller supplied buffer, then return + /* Stuff the string into the caller supplied buffer, then return * a pointer to it. */ - return stuffbuffer(buf, bufsize, result); + return stuffbuffer(buf, bufsize, result); } #elif defined(WIN32) || (defined(NETWARE) && defined(USE_WINSOCK)) @@ -267,7 +267,7 @@ static char *apr_os_strerror(char *buf, apr_size_t bufsize, apr_status_t errcode apr_size_t len=0, i; #ifndef NETWARE - len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM + len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errcode, @@ -311,10 +311,10 @@ static char *apr_os_strerror(char *buf, apr_size_t bufsize, apr_status_t errcode } #else -/* On Unix, apr_os_strerror() handles error codes from the resolver - * (h_errno). +/* On Unix, apr_os_strerror() handles error codes from the resolver + * (h_errno). */ -static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) +static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) { #ifdef HAVE_HSTRERROR return stuffbuffer(buf, bufsize, hstrerror(err)); @@ -351,7 +351,7 @@ static char *native_strerror(apr_status_t statcode, char *buf, apr_size_t bufsize) { if (strerror_r(statcode, buf, bufsize) < 0) { - return stuffbuffer(buf, bufsize, + return stuffbuffer(buf, bufsize, "APR does not understand this error code"); } else { @@ -384,7 +384,7 @@ static char *native_strerror(apr_status_t statcode, char *buf, } } #else -/* plain old strerror(); +/* plain old strerror(); * thread-safe on some platforms (e.g., Solaris, OS/390) */ static char *native_strerror(apr_status_t statcode, char *buf, @@ -394,7 +394,7 @@ static char *native_strerror(apr_status_t statcode, char *buf, if (err) { return stuffbuffer(buf, bufsize, err); } else { - return stuffbuffer(buf, bufsize, + return stuffbuffer(buf, bufsize, "APR does not understand this error code"); } } diff --git a/misc/unix/getopt.c b/misc/unix/getopt.c index 24be3c82f..b6bcf1902 100644 --- a/misc/unix/getopt.c +++ b/misc/unix/getopt.c @@ -68,7 +68,7 @@ APR_DECLARE(apr_status_t) apr_getopt_init(apr_getopt_t **os, apr_pool_t *cont, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, +APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, char *optch, const char **optarg) { const char *oli; /* option letter list index */ @@ -121,7 +121,7 @@ APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, return (APR_BADARG); } if (os->errfn) { - (os->errfn)(os->errarg, + (os->errfn)(os->errarg, "%s: option requires an argument -- %c\n", apr_filepath_name_get(*os->argv), os->opt); } @@ -182,7 +182,7 @@ static apr_status_t serr(apr_getopt_t *os, const char *err, const char *str, apr_status_t status) { if (os->errfn) - (os->errfn)(os->errarg, "%s: %s: %s\n", + (os->errfn)(os->errarg, "%s: %s: %s\n", apr_filepath_name_get(*os->argv), err, str); return status; } @@ -192,7 +192,7 @@ static apr_status_t cerr(apr_getopt_t *os, const char *err, int ch, apr_status_t status) { if (os->errfn) - (os->errfn)(os->errarg, "%s: %s: %c\n", + (os->errfn)(os->errarg, "%s: %s: %c\n", apr_filepath_name_get(*os->argv), err, ch); return status; } @@ -251,7 +251,7 @@ APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os, if (opts[i].has_arg) { if (p[len] == '=') /* Argument inline */ *optarg = p + len + 1; - else { + else { if (os->ind >= os->argc) /* Argument missing */ return serr(os, "missing argument", p - 2, APR_BADARG); else /* Argument in next arg */ @@ -270,7 +270,7 @@ APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os, os->ind = os->skip_start; return APR_EOF; } - else + else if (*p == '\0') /* Bare "-" is illegal */ return serr(os, "invalid option", p, APR_BADCH); } @@ -292,7 +292,7 @@ APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os, if (opts[i].has_arg) { if (*p != '\0') /* Argument inline */ *optarg = p; - else { + else { if (os->ind >= os->argc) /* Argument missing */ return cerr(os, "missing argument", *optch, APR_BADARG); else /* Argument in next arg */ diff --git a/misc/unix/otherchild.c b/misc/unix/otherchild.c index a2fef19ac..be035a735 100644 --- a/misc/unix/otherchild.c +++ b/misc/unix/otherchild.c @@ -65,7 +65,7 @@ APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc, ocr->data = data; ocr->next = other_children; other_children = ocr; - apr_pool_cleanup_register(p, ocr->data, other_child_cleanup, + apr_pool_cleanup_register(p, ocr->data, other_child_cleanup, apr_pool_cleanup_null); } @@ -107,7 +107,7 @@ APR_DECLARE(apr_status_t) apr_proc_other_child_alert(apr_proc_t *proc, APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr, int reason) { - /* Todo: + /* Todo: * Implement code to detect if pipes are still alive. */ #ifdef WIN32 @@ -168,7 +168,7 @@ APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr, break; } #else /* ndef Win32 */ - pid_t waitret; + pid_t waitret; int status; if (ocr->proc == NULL) diff --git a/misc/unix/rand.c b/misc/unix/rand.c index c0567a667..4af86ee16 100644 --- a/misc/unix/rand.c +++ b/misc/unix/rand.c @@ -103,13 +103,13 @@ APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data) return APR_SUCCESS; } -#endif +#endif #endif /* APR_HAS_OS_UUID */ #if APR_HAS_RANDOM -APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, +APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, apr_size_t length) { #if defined(HAVE_EGD) @@ -121,9 +121,9 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, * 0xMM (bytes granted) MM bytes * 0x02 (read entropy blocking) 0xNN (bytes desired) * [block] NN bytes - * 0x03 (write entropy) 0xMM 0xLL (bits of entropy) 0xNN (bytes of data) + * 0x03 (write entropy) 0xMM 0xLL (bits of entropy) 0xNN (bytes of data) * NN bytes - * (no response - write only) + * (no response - write only) * 0x04 (report PID) * 0xMM (length of PID string, not null-terminated) MM chars */ @@ -139,7 +139,7 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, for (egdsockname = egd_sockets; *egdsockname && length > 0; egdsockname++) { egd_path_len = strlen(*egdsockname); - + if (egd_path_len > sizeof(addr.sun_path)) { return APR_EINVAL; } @@ -147,8 +147,8 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, memset(&addr, 0, sizeof(struct sockaddr_un)); addr.sun_family = AF_UNIX; memcpy(addr.sun_path, *egdsockname, egd_path_len); - egd_addr_len = APR_OFFSETOF(struct sockaddr_un, sun_path) + - egd_path_len; + egd_addr_len = APR_OFFSETOF(struct sockaddr_un, sun_path) + + egd_path_len; egd_socket = socket(PF_UNIX, SOCK_STREAM, 0); @@ -163,7 +163,7 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, continue; } - /* EGD can only return 255 bytes of data at a time. Silly. */ + /* EGD can only return 255 bytes of data at a time. Silly. */ while (length > 0) { apr_ssize_t srv; req[0] = 2; /* We'll block for now. */ @@ -182,7 +182,7 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, close(egd_socket); return APR_EGENERAL; } - + resp_expected = req[1]; srv = read(egd_socket, resp, resp_expected); if (srv == -1) { @@ -191,12 +191,12 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, close(egd_socket); return bad_errno; } - + memcpy(curbuf, resp, srv); curbuf += srv; length -= srv; } - + shutdown(egd_socket, SHUT_RDWR); close(egd_socket); } @@ -242,7 +242,7 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, if (fd == -1) if ((fd = open(DEV_RANDOM, O_RDONLY)) == -1) return errno; - + do { rc = read(fd, buf, length); } while (rc == -1 && errno == EINTR); @@ -261,7 +261,7 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, length -= rc; } } while (length > 0); - + close(fd); #elif defined(OS2) diff --git a/misc/unix/start.c b/misc/unix/start.c index 8dcc1d989..8ebe2726e 100644 --- a/misc/unix/start.c +++ b/misc/unix/start.c @@ -24,8 +24,8 @@ #include "apr_arch_internal_time.h" -APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, - const char * const * *argv, +APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, + const char * const * *argv, const char * const * *env) { /* An absolute noop. At present, only Win32 requires this stub, but it's @@ -54,7 +54,7 @@ APR_DECLARE(apr_status_t) apr_initialize(void) if ((status = apr_pool_initialize()) != APR_SUCCESS) return status; - + if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { return APR_ENOPOOL; } @@ -80,7 +80,7 @@ APR_DECLARE_NONSTD(void) apr_terminate(void) return; } apr_pool_terminate(); - + } APR_DECLARE(void) apr_terminate2(void) diff --git a/misc/win32/apr_app.c b/misc/win32/apr_app.c index 6d29b1411..71f51d1d6 100644 --- a/misc/win32/apr_app.c +++ b/misc/win32/apr_app.c @@ -31,7 +31,7 @@ * _dbg_malloc/realloc is used in place of the usual API, in order * to convince the MSVCRT that it created these entities. If we * do not create them as _CRT_BLOCK entities, the crt will fault - * on an assert. We are not worrying about the crt's locks here, + * on an assert. We are not worrying about the crt's locks here, * since we are single threaded [so far]. */ diff --git a/misc/win32/internal.c b/misc/win32/internal.c index 783a8dc29..6582a5014 100644 --- a/misc/win32/internal.c +++ b/misc/win32/internal.c @@ -29,7 +29,7 @@ */ -/* Shared by apr_app.c and start.c +/* Shared by apr_app.c and start.c * * An internal apr function to convert an array of strings (either * a counted or NULL terminated list, such as an argv[argc] or env[] @@ -37,7 +37,7 @@ * These are allocated from the MSVCRT's _CRT_BLOCK to trick the system * into trusting our store. */ -int apr_wastrtoastr(char const * const * *retarr, +int apr_wastrtoastr(char const * const * *retarr, wchar_t const * const *arr, int args) { apr_size_t elesize = 0; diff --git a/misc/win32/misc.c b/misc/win32/misc.c index 0ae3b6ff0..2e39cd6f6 100644 --- a/misc/win32/misc.c +++ b/misc/win32/misc.c @@ -25,7 +25,7 @@ APR_DECLARE_DATA apr_oslevel_e apr_os_level = APR_WIN_UNK; apr_status_t apr_get_oslevel(apr_oslevel_e *level) { - if (apr_os_level == APR_WIN_UNK) + if (apr_os_level == APR_WIN_UNK) { OSVERSIONINFOEXW oslev; oslev.dwOSVersionInfoSize = sizeof(oslev); @@ -33,7 +33,7 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *level) return apr_get_os_error(); } - if (oslev.dwPlatformId == VER_PLATFORM_WIN32_NT) + if (oslev.dwPlatformId == VER_PLATFORM_WIN32_NT) { unsigned int servpack = oslev.wServicePackMajor; @@ -94,7 +94,7 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *level) } -/* This is the helper code to resolve late bound entry points +/* This is the helper code to resolve late bound entry points * missing from one or more releases of the Win32 API */ @@ -222,7 +222,7 @@ DWORD apr_wait_for_single_object(HANDLE handle, apr_interval_time_t timeout) /* Declared in include/arch/win32/apr_dbg_win32_handles.h */ -APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, +APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, int nh, /* HANDLE hv, char *dsc */...) { static DWORD tlsid = 0xFFFFFFFF; @@ -232,7 +232,7 @@ APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, long seq; DWORD wrote; char *sbuf; - + seq = (InterlockedIncrement)(&ctr); if (tlsid == 0xFFFFFFFF) { @@ -248,7 +248,7 @@ APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, (GetModuleFileNameA)(NULL, sbuf, 250); sprintf(strchr(sbuf, '\0'), ".%u", (unsigned int)(GetCurrentProcessId)()); - fh = (CreateFileA)(sbuf, GENERIC_WRITE, 0, NULL, + fh = (CreateFileA)(sbuf, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); (InitializeCriticalSection)(&cs); } @@ -261,7 +261,7 @@ APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, (EnterCriticalSection)(&cs); (WriteFile)(fh, sbuf, (DWORD)strlen(sbuf), &wrote, NULL); (LeaveCriticalSection)(&cs); - } + } else { va_list a; va_start(a,nh); @@ -270,7 +270,7 @@ APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, HANDLE *hv = va_arg(a, HANDLE*); char *dsc = va_arg(a, char*); if (strcmp(dsc, "Signaled") == 0) { - if ((apr_ssize_t)ha >= STATUS_WAIT_0 + if ((apr_ssize_t)ha >= STATUS_WAIT_0 && (apr_ssize_t)ha < STATUS_ABANDONED_WAIT_0) { hv += (apr_ssize_t)ha; } @@ -285,7 +285,7 @@ APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, } (sprintf)(sbuf, "%p %08x %08x %s(%s) %s:%d\n", *hv, (unsigned int)seq, - (unsigned int)GetCurrentThreadId(), + (unsigned int)GetCurrentThreadId(), fn, dsc, fl, ln); (WriteFile)(fh, sbuf, (DWORD)strlen(sbuf), &wrote, NULL); } while (--nh); diff --git a/misc/win32/rand.c b/misc/win32/rand.c index 855fbe4fd..38689eb15 100644 --- a/misc/win32/rand.c +++ b/misc/win32/rand.c @@ -46,7 +46,7 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf, APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data) { - /* Note: this call doesn't actually require CoInitialize() first + /* Note: this call doesn't actually require CoInitialize() first * * XXX: we should scramble the bytes or some such to eliminate the * possible misuse/abuse since uuid is based on the NIC address, and diff --git a/misc/win32/utf8.c b/misc/win32/utf8.c index cba5d4934..9fceea362 100644 --- a/misc/win32/utf8.c +++ b/misc/win32/utf8.c @@ -27,10 +27,10 @@ * used as the actual storage conventions by that archicture, these functions * exist to transform or validate utf-16 strings into APR's 'char' type * convention. It is left up to the operating system to determine the - * validitity of the string, e.g. normative forms, in the context of - * its native language support. Other file systems which support filename + * validitity of the string, e.g. normative forms, in the context of + * its native language support. Other file systems which support filename * characters of 0x80-0xff but have no explicit requirement for Unicode - * will find this function useful only for validating the character sequences + * will find this function useful only for validating the character sequences * and rejecting poorly encoded utf-8 sequences. * * len utf-4 range (hex) utf-8 octet sequence (binary) @@ -46,10 +46,10 @@ * For conversion into utf-16, the 4th form is limited in range to 0010 FFFF, * and the final two forms are used only by full utf-32, per RFC 3629; * - * "Pairs of UCS-2 values between D800 and DFFF (surrogate pairs in - * Unicode parlance), being actually UCS-4 characters transformed - * through UTF-16, need special treatment: the UTF-16 transformation - * must be undone, yielding a UCS-4 character that is then transformed + * "Pairs of UCS-2 values between D800 and DFFF (surrogate pairs in + * Unicode parlance), being actually UCS-4 characters transformed + * through UTF-16, need special treatment: the UTF-16 transformation + * must be undone, yielding a UCS-4 character that is then transformed * as above." * * From RFC2781 UTF-16: the compressed ISO 10646 encoding bitmask @@ -62,7 +62,7 @@ * Max U = 0000 00010000 11111111 11111111 * * Also note ISO/IEC 10646:2014 Clause 9.4: "Because surrogate code points - * are not UCS scalar values, UTF-32 code units in the range + * are not UCS scalar values, UTF-32 code units in the range * 0000 D800-0000 DFFF are ill-formed" for future reference in adding any * utf-32 accessor functions. * @@ -73,16 +73,16 @@ * apr_conv_utf16_to_utf8 out words:sizeof(in) / 2 <= Req <= sizeof(in) * 3 / 2 */ -APR_DECLARE(apr_status_t) apr_conv_utf8_to_utf16(const char *in, +APR_DECLARE(apr_status_t) apr_conv_utf8_to_utf16(const char *in, apr_size_t *inbytes, - apr_wchar_t *out, + apr_wchar_t *out, apr_size_t *outwords) { apr_int64_t newch, mask; apr_size_t expect, eating; int ch; - - while (*inbytes && *outwords) + + while (*inbytes && *outwords) { ch = (unsigned char)(*in++); if (!(ch & 0200)) { @@ -94,7 +94,7 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_to_utf16(const char *in, } else { - if ((ch & 0300) != 0300) { + if ((ch & 0300) != 0300) { /* Multibyte Continuation is out of place */ return APR_EINVAL; @@ -147,7 +147,7 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_to_utf16(const char *in, /* Where the boolean (expect > 2) is true, we will need * an extra word for the output. */ - if (*outwords < (apr_size_t)(expect > 2) + 1) + if (*outwords < (apr_size_t)(expect > 2) + 1) break; /* buffer full */ while (expect--) { @@ -162,17 +162,17 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_to_utf16(const char *in, * * now we need to fold to utf-16 */ - if (newch < 0x10000) + if (newch < 0x10000) { --*outwords; *(out++) = (apr_wchar_t) newch; } - else + else { *outwords -= 2; newch -= 0x10000; *(out++) = (apr_wchar_t) (0xD800 | (newch >> 10)); - *(out++) = (apr_wchar_t) (0xDC00 | (newch & 0x03FF)); + *(out++) = (apr_wchar_t) (0xDC00 | (newch & 0x03FF)); } } } @@ -183,17 +183,17 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_to_utf16(const char *in, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_conv_utf16_to_utf8(const apr_wchar_t *in, +APR_DECLARE(apr_status_t) apr_conv_utf16_to_utf8(const apr_wchar_t *in, apr_size_t *inwords, - char *out, + char *out, apr_size_t *outbytes) { apr_int64_t newch, require; apr_size_t need; char *invout; int ch; - - while (*inwords && *outbytes) + + while (*inwords && *outbytes) { ch = (unsigned short)(*in++); if (ch < 0x80) @@ -202,7 +202,7 @@ APR_DECLARE(apr_status_t) apr_conv_utf16_to_utf8(const apr_wchar_t *in, --*outbytes; *(out++) = (unsigned char) ch; } - else + else { if ((ch & 0xFC00) == 0xDC00) { /* Invalid Leading utf-16 Multiword Continuation Character @@ -259,5 +259,5 @@ APR_DECLARE(apr_status_t) apr_conv_utf16_to_utf8(const apr_wchar_t *in, /* Buffer full 'errors' aren't errors, the client must inspect both * the inwords and outbytes values */ - return APR_SUCCESS; + return APR_SUCCESS; } |