diff options
| author | Alex Shlyapnikov <alekseys@google.com> | 2018-04-20 20:24:02 +0000 |
|---|---|---|
| committer | Alex Shlyapnikov <alekseys@google.com> | 2018-04-20 20:24:02 +0000 |
| commit | 8368bd82c3df16526fbf23117cb89c10a0d96e9c (patch) | |
| tree | 72b7df245b4022b7c1672604521d98d1550d6b00 | |
| parent | 99cf54baa65e03e027da5b6b928eec2759398056 (diff) | |
| download | bcm5719-llvm-8368bd82c3df16526fbf23117cb89c10a0d96e9c.tar.gz bcm5719-llvm-8368bd82c3df16526fbf23117cb89c10a0d96e9c.zip | |
Revert "[Sanitizer] Internal Printf string precision argument + padding."
This reverts commit r330458.
There are existing code using string precision as 'max len', need more
work.
llvm-svn: 330476
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_printf.cc | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc | 9 |
2 files changed, 2 insertions, 9 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc index 59f9b970178..5c2360043b0 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc @@ -105,8 +105,6 @@ static int AppendString(char **buff, const char *buff_end, int precision, break; result += AppendChar(buff, buff_end, *s); } - while (result < precision) - result += AppendChar(buff, buff_end, ' '); return result; } diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc index f8dac894256..5a77b470caf 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc @@ -146,13 +146,8 @@ TEST(Printf, Precision) { EXPECT_EQ(3U, len); EXPECT_STREQ("123", buf); len = internal_snprintf(buf, sizeof(buf), "%.*s", 6, "12345"); - EXPECT_EQ(6U, len); - EXPECT_STREQ("12345 ", buf); - // CHeck that precision does not overflow the smaller buffer, although - // 10 chars is requested, it stops at the buffer size, 8. - len = internal_snprintf(buf, 8, "%.*s", 10, "12345"); - EXPECT_EQ(10U, len); // The required size reported. - EXPECT_STREQ("12345 ", buf); + EXPECT_EQ(5U, len); + EXPECT_STREQ("12345", buf); } } // namespace __sanitizer |

