mirror of
https://github.com/fmtlib/fmt.git
synced 2026-06-15 08:26:13 +08:00
Compare commits
3 Commits
a4f3cfe819
...
381e7c0d24
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
381e7c0d24 | ||
|
|
e60274b29c | ||
|
|
87bb05d3b2 |
5
.github/workflows/lint.yml
vendored
5
.github/workflows/lint.yml
vendored
@ -2,11 +2,6 @@ name: lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '**.h'
|
||||
- '**.cc'
|
||||
- '**.cmake'
|
||||
- '**/CMakeLists.txt'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
@ -87,7 +87,10 @@ jobs:
|
||||
permissions:
|
||||
actions: read
|
||||
id-token: write
|
||||
contents: read
|
||||
# contents: write is required because the generator's (skipped)
|
||||
# upload-assets job declares it, and a reusable workflow's job
|
||||
# permissions may not exceed the caller's, or the run fails at startup.
|
||||
contents: write
|
||||
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0
|
||||
with:
|
||||
base64-subjects: ${{ needs.build.outputs.hashes }}
|
||||
|
||||
@ -2593,7 +2593,7 @@ template <typename Context> class basic_format_args {
|
||||
FMT_CONSTEXPR auto get(int id) const -> format_arg {
|
||||
auto arg = format_arg();
|
||||
if (!is_packed()) {
|
||||
if (id < max_size()) arg = args_[id];
|
||||
if (unsigned(id) < unsigned(max_size())) arg = args_[id];
|
||||
return arg;
|
||||
}
|
||||
if (unsigned(id) >= detail::max_packed_args) return arg;
|
||||
|
||||
@ -116,6 +116,17 @@ TEST(printf_test, invalid_arg_index) {
|
||||
"argument not found");
|
||||
}
|
||||
|
||||
TEST(printf_test, zero_positional_width_precision) {
|
||||
// A '0' positional index for a '*' width or precision must be rejected. Use
|
||||
// enough arguments to exercise the unpacked argument storage path.
|
||||
EXPECT_THROW_MSG(test_sprintf("%*0$d", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
||||
13, 14, 15, 16),
|
||||
format_error, "argument not found");
|
||||
EXPECT_THROW_MSG(test_sprintf("%.*0$d", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
||||
13, 14, 15, 16),
|
||||
format_error, "argument not found");
|
||||
}
|
||||
|
||||
TEST(printf_test, default_align_right) {
|
||||
EXPECT_PRINTF(" 42", "%5d", 42);
|
||||
EXPECT_PRINTF(" abc", "%5s", "abc");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user