Skip to content

Commit 850a96a

Browse files
authored
Merge pull request #53 from zrax/gcc15_opt_warnings
Silence a couple of GCC 15 warnings in optimized (Release) builds.
2 parents 1a6b342 + 2f29f2a commit 850a96a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

include/st_formatter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ namespace ST
304304
ST_NODISCARD
305305
formatter_ref_t make_formatter_ref(type_T value)
306306
{
307-
return [value](const ST::format_spec &format, ST::format_writer &output) {
307+
return [value = std::forward<type_T>(value)](
308+
const ST::format_spec &format, ST::format_writer &output) {
308309
format_type(format, output, value);
309310
};
310311
}

include/st_string.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,9 +2031,7 @@ namespace ST
20312031
string substr(ST_ssize_t start, size_t count = ST_AUTO_SIZE) const
20322032
{
20332033
size_t max = size();
2034-
2035-
if (count == ST_AUTO_SIZE)
2036-
count = max;
2034+
count = std::min<size_t>(max, count);
20372035

20382036
if (start < 0) {
20392037
// Handle negative indexes from the right side of the string

0 commit comments

Comments
 (0)