Try fixing bogus coverity warnings, take n
This commit is contained in:
parent
b64913b00b
commit
fb27723a9f
@ -140,8 +140,9 @@ template <>
|
|||||||
struct IntChecker<true> {
|
struct IntChecker<true> {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static bool fits_in_int(T value) {
|
static bool fits_in_int(T value) {
|
||||||
return internal::check(value >= INT_MIN) && value <= INT_MAX;
|
return value >= INT_MIN && value <= INT_MAX;
|
||||||
}
|
}
|
||||||
|
static bool fits_in_int(int value) { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
const char RESET_COLOR[] = "\x1b[0m";
|
const char RESET_COLOR[] = "\x1b[0m";
|
||||||
|
@ -42,6 +42,13 @@ using testing::internal::scoped_ptr;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
std::string sanitize(const std::string &s) {
|
||||||
|
std::string result;
|
||||||
|
for (std::string::const_iterator i = s.begin(), end = s.end(); i != end; ++i)
|
||||||
|
result.push_back(*i & 0xff);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// Tests that assertion macros evaluate their arguments exactly once.
|
// Tests that assertion macros evaluate their arguments exactly once.
|
||||||
class SingleEvaluationTest : public ::testing::Test {
|
class SingleEvaluationTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
@ -377,8 +384,7 @@ TEST(OutputRedirectTest, RestoreAndRead) {
|
|||||||
std::fprintf(file.get(), "[[[");
|
std::fprintf(file.get(), "[[[");
|
||||||
OutputRedirect redir(file.get());
|
OutputRedirect redir(file.get());
|
||||||
std::fprintf(file.get(), "censored");
|
std::fprintf(file.get(), "censored");
|
||||||
// coverity[tainted_data]
|
EXPECT_EQ("censored", sanitize(redir.restore_and_read()));
|
||||||
EXPECT_EQ("censored", redir.restore_and_read());
|
|
||||||
EXPECT_EQ("", redir.restore_and_read());
|
EXPECT_EQ("", redir.restore_and_read());
|
||||||
std::fprintf(file.get(), "]]]");
|
std::fprintf(file.get(), "]]]");
|
||||||
file = BufferedFile();
|
file = BufferedFile();
|
||||||
|
Loading…
Reference in New Issue
Block a user