|
2824 | 2824 |
|
2825 | 2825 | using string_storage_oct_type = |
2826 | 2826 | std::conditional_t |
2827 | | - <my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 2827 | + <my_width2 <= static_cast<size_t>(UINT32_C(512)), |
2828 | 2828 | detail::fixed_static_array <char, |
2829 | 2829 | wr_string_max_buffer_size_oct()>, |
2830 | 2830 | detail::fixed_dynamic_array<char, |
|
2916 | 2916 |
|
2917 | 2917 | using string_storage_dec_type = |
2918 | 2918 | std::conditional_t |
2919 | | - <my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 2919 | + <my_width2 <= static_cast<size_t>(UINT32_C(512)), |
2920 | 2920 | detail::fixed_static_array <char, |
2921 | 2921 | wr_string_max_buffer_size_dec()>, |
2922 | 2922 | detail::fixed_dynamic_array<char, |
|
3009 | 3009 |
|
3010 | 3010 | using string_storage_hex_type = |
3011 | 3011 | std::conditional_t |
3012 | | - <my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 3012 | + <my_width2 <= static_cast<size_t>(UINT32_C(512)), |
3013 | 3013 | detail::fixed_static_array <char, |
3014 | 3014 | wr_string_max_buffer_size_hex()>, |
3015 | 3015 | detail::fixed_dynamic_array<char, |
|
5757 | 5757 | { |
5758 | 5758 | using string_storage_oct_type = |
5759 | 5759 | std::conditional_t |
5760 | | - <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 5760 | + <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(512)), |
5761 | 5761 | detail::fixed_static_array <char, |
5762 | 5762 | local_wide_integer_type::wr_string_max_buffer_size_oct()>, |
5763 | 5763 | detail::fixed_dynamic_array<char, |
|
5766 | 5766 | std::allocator<void>, |
5767 | 5767 | AllocatorType>>::template rebind_alloc<typename local_wide_integer_type::limb_type>>>; |
5768 | 5768 |
|
5769 | | - // TBD: There is redundant storage of this kind both here |
| 5769 | + // There is redundant storage of this kind both here |
5770 | 5770 | // in this subroutine as well as in the wr_string method. |
| 5771 | + // This is on purpose for convenience but might be |
| 5772 | + // changed in the future. |
5771 | 5773 | string_storage_oct_type str_result { }; // LCOV_EXCL_LINE |
5772 | 5774 |
|
5773 | 5775 | str_result.fill('\0'); |
|
5780 | 5782 | { |
5781 | 5783 | using string_storage_dec_type = |
5782 | 5784 | std::conditional_t |
5783 | | - <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 5785 | + <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(512)), |
5784 | 5786 | detail::fixed_static_array <char, |
5785 | 5787 | local_wide_integer_type::wr_string_max_buffer_size_dec()>, |
5786 | 5788 | detail::fixed_dynamic_array<char, |
|
5789 | 5791 | std::allocator<void>, |
5790 | 5792 | AllocatorType>>::template rebind_alloc<typename local_wide_integer_type::limb_type>>>; |
5791 | 5793 |
|
5792 | | - // TBD: There is redundant storage of this kind both here |
| 5794 | + // There is redundant storage of this kind both here |
5793 | 5795 | // in this subroutine as well as in the wr_string method. |
| 5796 | + // This is on purpose for convenience but might be |
| 5797 | + // changed in the future. |
5794 | 5798 | string_storage_dec_type str_result { }; |
5795 | 5799 |
|
5796 | 5800 | str_result.fill('\0'); |
|
5803 | 5807 | { |
5804 | 5808 | using string_storage_hex_type = |
5805 | 5809 | std::conditional_t |
5806 | | - <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 5810 | + <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(512)), |
5807 | 5811 | detail::fixed_static_array <char, |
5808 | 5812 | local_wide_integer_type::wr_string_max_buffer_size_hex()>, |
5809 | 5813 | detail::fixed_dynamic_array<char, |
|
7261 | 7265 | { |
7262 | 7266 | using string_storage_oct_type = |
7263 | 7267 | std::conditional_t |
7264 | | - <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 7268 | + <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(512)), |
7265 | 7269 | detail::fixed_static_array <char, |
7266 | 7270 | local_wide_integer_type::wr_string_max_buffer_size_oct()>, |
7267 | 7271 | detail::fixed_dynamic_array<char, |
|
7270 | 7274 | std::allocator<void>, |
7271 | 7275 | AllocatorType>>::template rebind_alloc<typename local_wide_integer_type::limb_type>>>; |
7272 | 7276 |
|
7273 | | - using local_size_type = typename string_storage_oct_type::size_type; |
7274 | | - |
7275 | 7277 | string_storage_oct_type str_temp { }; |
7276 | 7278 |
|
7277 | 7279 | const auto wr_string_is_ok = x.wr_string(str_temp.begin(), base_rep, show_base, show_pos, is_uppercase); |
7278 | 7280 |
|
7279 | 7281 | if(wr_string_is_ok) |
7280 | 7282 | { |
| 7283 | + using local_size_type = typename string_storage_oct_type::size_type; |
| 7284 | + |
7281 | 7285 | const auto chars_retrieved = static_cast<local_size_type>(detail::strlen_unsafe(str_temp.data())); |
7282 | 7286 |
|
7283 | 7287 | const auto chars_to_get = static_cast<local_size_type>(detail::distance_unsafe(first, last)); |
|
7286 | 7290 | str_temp.cbegin() + (detail::min_unsafe)(chars_retrieved, chars_to_get), |
7287 | 7291 | first); |
7288 | 7292 |
|
7289 | | - result.ec = std::errc(); |
| 7293 | + if(chars_retrieved <= chars_to_get) |
| 7294 | + { |
| 7295 | + result.ec = std::errc(); |
| 7296 | + } |
7290 | 7297 | } |
7291 | 7298 | } |
7292 | 7299 | else if(base_rep == static_cast<std::uint_fast8_t>(UINT8_C(16))) |
7293 | 7300 | { |
7294 | 7301 | using string_storage_hex_type = |
7295 | 7302 | std::conditional_t |
7296 | | - <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 7303 | + <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(512)), |
7297 | 7304 | detail::fixed_static_array <char, |
7298 | 7305 | local_wide_integer_type::wr_string_max_buffer_size_hex()>, |
7299 | 7306 | detail::fixed_dynamic_array<char, |
|
7302 | 7309 | std::allocator<void>, |
7303 | 7310 | AllocatorType>>::template rebind_alloc<typename local_wide_integer_type::limb_type>>>; |
7304 | 7311 |
|
7305 | | - using local_size_type = typename string_storage_hex_type::size_type; |
7306 | | - |
7307 | 7312 | string_storage_hex_type str_temp { }; |
7308 | 7313 |
|
7309 | 7314 | const auto wr_string_is_ok = x.wr_string(str_temp.begin(), base_rep, show_base, show_pos, is_uppercase); |
7310 | 7315 |
|
7311 | 7316 | if(wr_string_is_ok) |
7312 | 7317 | { |
| 7318 | + using local_size_type = typename string_storage_hex_type::size_type; |
| 7319 | + |
7313 | 7320 | const auto chars_retrieved = static_cast<local_size_type>(detail::strlen_unsafe(str_temp.data())); |
7314 | 7321 |
|
7315 | 7322 | const auto chars_to_get = static_cast<local_size_type>(detail::distance_unsafe(first, last)); |
|
7318 | 7325 | str_temp.cbegin() + (detail::min_unsafe)(chars_retrieved, chars_to_get), |
7319 | 7326 | first); |
7320 | 7327 |
|
7321 | | - result.ec = std::errc(); |
| 7328 | + if(chars_retrieved <= chars_to_get) |
| 7329 | + { |
| 7330 | + result.ec = std::errc(); |
| 7331 | + } |
7322 | 7332 | } |
7323 | 7333 | } |
7324 | 7334 | else |
7325 | 7335 | { |
7326 | 7336 | using string_storage_dec_type = |
7327 | 7337 | std::conditional_t |
7328 | | - <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 7338 | + <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(512)), |
7329 | 7339 | detail::fixed_static_array <char, |
7330 | 7340 | local_wide_integer_type::wr_string_max_buffer_size_dec()>, |
7331 | 7341 | detail::fixed_dynamic_array<char, |
|
7334 | 7344 | std::allocator<void>, |
7335 | 7345 | AllocatorType>>::template rebind_alloc<typename local_wide_integer_type::limb_type>>>; |
7336 | 7346 |
|
7337 | | - using local_size_type = typename string_storage_dec_type::size_type; |
7338 | | - |
7339 | 7347 | string_storage_dec_type str_temp { }; |
7340 | 7348 |
|
7341 | 7349 | const auto wr_string_is_ok = x.wr_string(str_temp.begin(), base_rep, show_base, show_pos, is_uppercase); |
7342 | 7350 |
|
7343 | 7351 | if(wr_string_is_ok) |
7344 | 7352 | { |
| 7353 | + using local_size_type = typename string_storage_dec_type::size_type; |
| 7354 | + |
7345 | 7355 | const auto chars_retrieved = static_cast<local_size_type>(detail::strlen_unsafe(str_temp.data())); |
7346 | 7356 |
|
7347 | 7357 | const auto chars_to_get = static_cast<local_size_type>(detail::distance_unsafe(first, last)); |
|
7350 | 7360 | str_temp.cbegin() + (detail::min_unsafe)(chars_retrieved, chars_to_get), |
7351 | 7361 | first); |
7352 | 7362 |
|
7353 | | - result.ec = std::errc(); |
| 7363 | + if(chars_retrieved <= chars_to_get) |
| 7364 | + { |
| 7365 | + result.ec = std::errc(); |
| 7366 | + } |
7354 | 7367 | } |
7355 | 7368 | } |
7356 | 7369 |
|
|
7415 | 7428 |
|
7416 | 7429 | using string_storage_dec_type = |
7417 | 7430 | std::conditional_t |
7418 | | - <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(2048)), |
| 7431 | + <local_wide_integer_type::my_width2 <= static_cast<size_t>(UINT32_C(512)), |
7419 | 7432 | detail::fixed_static_array <char, |
7420 | 7433 | local_wide_integer_type::wr_string_max_buffer_size_dec()>, |
7421 | 7434 | detail::fixed_dynamic_array<char, |
|
0 commit comments