diff options
author | mikhnenko <[email protected]> | 2024-12-18 19:08:08 +0300 |
---|---|---|
committer | mikhnenko <[email protected]> | 2024-12-18 19:29:26 +0300 |
commit | 7ed76959e6c06dbc4c249ce0f3b930463a6b65db (patch) | |
tree | 0e9528cb7261812a5ae7ed177048721eaebf8ed0 /contrib/libs/cxxsupp/libcxx/src/support/ibm | |
parent | 4c8e7f015711b5175d63e1a87cbd40c49ce7aa70 (diff) |
libc++: Run clang-format from upstream and update to 9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7
commit_hash:ca4954fe054e5a7190ad11ab71bfc7ca0965bca2
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/src/support/ibm')
3 files changed, 47 insertions, 52 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/src/support/ibm/mbsnrtowcs.cpp b/contrib/libs/cxxsupp/libcxx/src/support/ibm/mbsnrtowcs.cpp index 6edc3c254de..122dc5ed892 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/ibm/mbsnrtowcs.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/support/ibm/mbsnrtowcs.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include <cstddef> // size_t -#include <cwchar> // mbstate_t +#include <cstddef> // size_t +#include <cwchar> // mbstate_t #include <limits.h> // MB_LEN_MAX #include <string.h> // wmemcpy @@ -18,12 +18,14 @@ // Returns (size_t) -1 when an invalid sequence is encountered. // Leaves *`src` pointing to the next character to convert or NULL // if a null character was converted from *`src`. -_LIBCPP_EXPORTED_FROM_ABI -size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, - size_t src_size_bytes, size_t max_dest_chars, - mbstate_t *__restrict ps) { +_LIBCPP_EXPORTED_FROM_ABI size_t mbsnrtowcs( + wchar_t* __restrict dst, + const char** __restrict src, + size_t src_size_bytes, + size_t max_dest_chars, + mbstate_t* __restrict ps) { const size_t terminated_sequence = static_cast<size_t>(0); - const size_t invalid_sequence = static_cast<size_t>(-1); + const size_t invalid_sequence = static_cast<size_t>(-1); const size_t incomplete_sequence = static_cast<size_t>(-2); size_t source_converted; @@ -43,7 +45,7 @@ size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, // If result (char_size) is zero, it indicates that the null character has been found. // Otherwise, it's an error and errno may be set. size_t source_remaining = src_size_bytes - source_converted; - size_t dest_remaining = max_dest_chars - dest_converted; + size_t dest_remaining = max_dest_chars - dest_converted; if (dst == nullptr) { result = mbrtowc(NULL, *src + source_converted, source_remaining, ps); @@ -52,12 +54,12 @@ size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, result = mbrtowc(dst + dest_converted, *src + source_converted, source_remaining, ps); } else { /* - * dst may not have enough space, so use a temporary buffer. - * - * We need to save a copy of the conversion state - * here so we can restore it if the multibyte - * character is too long for the buffer. - */ + * dst may not have enough space, so use a temporary buffer. + * + * We need to save a copy of the conversion state + * here so we can restore it if the multibyte + * character is too long for the buffer. + */ wchar_t buff[MB_LEN_MAX]; mbstate_t mbstate_tmp; diff --git a/contrib/libs/cxxsupp/libcxx/src/support/ibm/wcsnrtombs.cpp b/contrib/libs/cxxsupp/libcxx/src/support/ibm/wcsnrtombs.cpp index d6333fe5f1f..f0372152339 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/ibm/wcsnrtombs.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/support/ibm/wcsnrtombs.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include <cwchar> // mbstate_t +#include <cwchar> // mbstate_t #include <limits.h> // MB_LEN_MAX #include <stdlib.h> // MB_CUR_MAX, size_t #include <string.h> // memcpy @@ -17,11 +17,12 @@ // converted from *src, excluding the null terminator. // Returns (size_t) -1 if an error occurs and sets errno. // If `dst` is NULL, `dst_size_bytes` is ignored and no bytes are copied to `dst`. -_LIBCPP_EXPORTED_FROM_ABI -size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, - size_t max_source_chars, size_t dst_size_bytes, - mbstate_t *__restrict ps) { - +_LIBCPP_EXPORTED_FROM_ABI size_t wcsnrtombs( + char* __restrict dst, + const wchar_t** __restrict src, + size_t max_source_chars, + size_t dst_size_bytes, + mbstate_t* __restrict ps) { const size_t invalid_wchar = static_cast<size_t>(-1); size_t source_converted; @@ -36,7 +37,7 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, for (dest_converted = source_converted = 0; source_converted < max_source_chars && (!dst || dest_converted < dst_size_bytes); ++source_converted, dest_converted += result) { - wchar_t c = (*src)[source_converted]; + wchar_t c = (*src)[source_converted]; size_t dest_remaining = dst_size_bytes - dest_converted; if (dst == nullptr) { @@ -46,12 +47,12 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, result = wcrtomb(dst + dest_converted, c, ps); } else { /* - * dst may not have enough space, so use a temporary buffer. - * - * We need to save a copy of the conversion state - * here so we can restore it if the multibyte - * character is too long for the buffer. - */ + * dst may not have enough space, so use a temporary buffer. + * + * We need to save a copy of the conversion state + * here so we can restore it if the multibyte + * character is too long for the buffer. + */ char buff[MB_LEN_MAX]; mbstate_t mbstate_tmp; diff --git a/contrib/libs/cxxsupp/libcxx/src/support/ibm/xlocale_zos.cpp b/contrib/libs/cxxsupp/libcxx/src/support/ibm/xlocale_zos.cpp index 034a5b96605..4c20997b4eb 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/ibm/xlocale_zos.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/support/ibm/xlocale_zos.cpp @@ -39,7 +39,7 @@ locale_t newlocale(int category_mask, const char* locale, locale_t base) { if (base) { if (category_mask != LC_ALL_MASK) { // Copy base when it will not be overwritten. - memcpy(newloc, base, sizeof (locale_struct)); + memcpy(newloc, base, sizeof(locale_struct)); newloc->category_mask = category_mask | base->category_mask; } delete base; @@ -65,9 +65,7 @@ locale_t newlocale(int category_mask, const char* locale, locale_t base) { return (locale_t)newloc; } -void freelocale(locale_t locobj) { - delete locobj; -} +void freelocale(locale_t locobj) { delete locobj; } locale_t uselocale(locale_t newloc) { // Maintain current locale name(s). @@ -76,18 +74,12 @@ locale_t uselocale(locale_t newloc) { if (newloc) { // Set locales and check for errors. bool is_error = - (newloc->category_mask & LC_COLLATE_MASK && - setlocale(LC_COLLATE, newloc->lc_collate.c_str()) == NULL) || - (newloc->category_mask & LC_CTYPE_MASK && - setlocale(LC_CTYPE, newloc->lc_ctype.c_str()) == NULL) || - (newloc->category_mask & LC_MONETARY_MASK && - setlocale(LC_MONETARY, newloc->lc_monetary.c_str()) == NULL) || - (newloc->category_mask & LC_NUMERIC_MASK && - setlocale(LC_NUMERIC, newloc->lc_numeric.c_str()) == NULL) || - (newloc->category_mask & LC_TIME_MASK && - setlocale(LC_TIME, newloc->lc_time.c_str()) == NULL) || - (newloc->category_mask & LC_MESSAGES_MASK && - setlocale(LC_MESSAGES, newloc->lc_messages.c_str()) == NULL); + (newloc->category_mask & LC_COLLATE_MASK && setlocale(LC_COLLATE, newloc->lc_collate.c_str()) == NULL) || + (newloc->category_mask & LC_CTYPE_MASK && setlocale(LC_CTYPE, newloc->lc_ctype.c_str()) == NULL) || + (newloc->category_mask & LC_MONETARY_MASK && setlocale(LC_MONETARY, newloc->lc_monetary.c_str()) == NULL) || + (newloc->category_mask & LC_NUMERIC_MASK && setlocale(LC_NUMERIC, newloc->lc_numeric.c_str()) == NULL) || + (newloc->category_mask & LC_TIME_MASK && setlocale(LC_TIME, newloc->lc_time.c_str()) == NULL) || + (newloc->category_mask & LC_MESSAGES_MASK && setlocale(LC_MESSAGES, newloc->lc_messages.c_str()) == NULL); if (is_error) { setlocale(LC_ALL, current_loc_name.c_str()); @@ -108,24 +100,24 @@ locale_t uselocale(locale_t newloc) { std::string s; while (std::getline(ss, s, delimiter)) { - tokenized.push_back(s); + tokenized.push_back(s); } _LIBCPP_ASSERT_UNCATEGORIZED(tokenized.size() >= _NCAT, "locale-name list is too short"); - previous_loc->lc_collate = tokenized[LC_COLLATE]; - previous_loc->lc_ctype = tokenized[LC_CTYPE]; + previous_loc->lc_collate = tokenized[LC_COLLATE]; + previous_loc->lc_ctype = tokenized[LC_CTYPE]; previous_loc->lc_monetary = tokenized[LC_MONETARY]; - previous_loc->lc_numeric = tokenized[LC_NUMERIC]; - previous_loc->lc_time = tokenized[LC_TIME]; + previous_loc->lc_numeric = tokenized[LC_NUMERIC]; + previous_loc->lc_time = tokenized[LC_TIME]; // Skip LC_TOD. previous_loc->lc_messages = tokenized[LC_MESSAGES]; } else { - previous_loc->lc_collate = current_loc_name; - previous_loc->lc_ctype = current_loc_name; + previous_loc->lc_collate = current_loc_name; + previous_loc->lc_ctype = current_loc_name; previous_loc->lc_monetary = current_loc_name; - previous_loc->lc_numeric = current_loc_name; - previous_loc->lc_time = current_loc_name; + previous_loc->lc_numeric = current_loc_name; + previous_loc->lc_time = current_loc_name; previous_loc->lc_messages = current_loc_name; } |