From 0b231586ed7243614651b5b220143bc679815dec Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Sun, 15 Mar 2020 13:46:48 -0400 Subject: [PATCH] Update meta, remove redundant exception check --- include/boost/static_string/static_string.hpp | 5 ++--- meta/libraries.json | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/boost/static_string/static_string.hpp b/include/boost/static_string/static_string.hpp index 8770e38..c5f7c01 100644 --- a/include/boost/static_string/static_string.hpp +++ b/include/boost/static_string/static_string.hpp @@ -6297,9 +6297,6 @@ replace( const std::size_t n1 = detail::distance(i1, i2); const std::size_t n2 = read_back(false, j1, j2); const std::size_t pos = i1 - curr_data; - if (n2 > max_size() || curr_size - (std::min)(n1, curr_size - pos) >= max_size() - n2) - detail::throw_exception( - "replaced string exceeds max_size()"); // Rotate to the correct order. [i2, end] will now start with the replaced string, // continue to the existing string not being replaced, and end with a null terminator std::rotate(&curr_data[pos], &curr_data[curr_size + 1], &curr_data[curr_size + n2 + 1]); @@ -6446,6 +6443,8 @@ read_back( { if (new_size >= max_size()) { + // if we overwrote the null terminator, + // put it back if (overwrite_null) term(); detail::throw_exception( diff --git a/meta/libraries.json b/meta/libraries.json index 51a81a0..a290f6d 100644 --- a/meta/libraries.json +++ b/meta/libraries.json @@ -1,8 +1,8 @@ { "key": "static_string", - "name": "StaticString", + "name": "Static String", "authors": [ - "Krystian Stasiowski", + "Krystian Stasiowski", "Vinnie Falco" ], "description": "A fixed capacity dynamically sized string.",