mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 09:28:21 +00:00
Fix warning.
This commit is contained in:
parent
d2e7554f74
commit
c3b3c0fafe
@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include "gtest-extra.h"
|
#include "gtest-extra.h"
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@ -63,8 +62,18 @@ class SuppressAssert {
|
|||||||
};
|
};
|
||||||
|
|
||||||
# define SUPPRESS_ASSERT(statement) { SuppressAssert sa; statement; }
|
# define SUPPRESS_ASSERT(statement) { SuppressAssert sa; statement; }
|
||||||
|
|
||||||
|
// Fix "secure" warning about using fopen without defining
|
||||||
|
// _CRT_SECURE_NO_WARNINGS.
|
||||||
|
std::FILE *OpenFile(const char *filename, const char *mode) {
|
||||||
|
std::FILE *f = 0;
|
||||||
|
errno = fopen_s(&f, filename, mode);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
#define fopen OpenFile
|
||||||
#else
|
#else
|
||||||
# define SUPPRESS_ASSERT(statement) statement
|
# define SUPPRESS_ASSERT(statement) statement
|
||||||
|
using std::fopen;
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#define EXPECT_SYSTEM_ERROR_NOASSERT(statement, error_code, message) \
|
#define EXPECT_SYSTEM_ERROR_NOASSERT(statement, error_code, message) \
|
||||||
@ -419,7 +428,7 @@ TEST(FileTest, DefaultCtor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(FileTest, OpenBufferedFileInCtor) {
|
TEST(FileTest, OpenBufferedFileInCtor) {
|
||||||
FILE *fp = std::fopen("test-file", "w");
|
FILE *fp = fopen("test-file", "w");
|
||||||
std::fputs(FILE_CONTENT, fp);
|
std::fputs(FILE_CONTENT, fp);
|
||||||
std::fclose(fp);
|
std::fclose(fp);
|
||||||
File f("test-file", File::RDONLY);
|
File f("test-file", File::RDONLY);
|
||||||
|
Loading…
Reference in New Issue
Block a user