Use actual example code and move safe_fopen to os-test
This commit is contained in:
+12
-1
@@ -19,10 +19,21 @@ using fmt::buffered_file;
|
||||
using testing::HasSubstr;
|
||||
using wstring_view = fmt::basic_string_view<wchar_t>;
|
||||
|
||||
static std::string uniq_file_name(unsigned line_number) {
|
||||
static auto uniq_file_name(unsigned line_number) -> std::string {
|
||||
return "test-file" + std::to_string(line_number);
|
||||
}
|
||||
|
||||
auto safe_fopen(const char* filename, const char* mode) -> FILE* {
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
// Fix MSVC warning about "unsafe" fopen.
|
||||
FILE* f = nullptr;
|
||||
errno = fopen_s(&f, filename, mode);
|
||||
return f;
|
||||
#else
|
||||
return std::fopen(filename, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
# include <windows.h>
|
||||
|
||||
Reference in New Issue
Block a user