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
This commit is contained in:
Alex Shlyapnikov 2018-04-20 20:24:02 +00:00
parent 99cf54baa6
commit 8368bd82c3
2 changed files with 2 additions and 9 deletions

View File

@ -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;
}

View File

@ -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