Skip to content

Commit d21ec95

Browse files
committed
use fopen instead fopen_s
Commit 683a26e (add _CRT_SECURE_NO_WARNINGS definition, 2024-03-13) removed need to use not standard, secure implementations of some CRT functions on windows. This commit removes use of fopen_s on windows. ref: #317
1 parent 7533691 commit d21ec95

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

src/utils/utils_log.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,7 @@ void util_log_init(void) {
159159
if (len <= MAX_FILE_PATH) {
160160
memcpy(file, arg, len);
161161
file[len] = '\0';
162-
#ifdef _WIN32
163-
if (fopen_s(&loggerConfig.output, file, "w")) {
164-
loggerConfig.output = NULL;
165-
}
166-
#else
167162
loggerConfig.output = fopen(file, "w");
168-
#endif
169163
}
170164
if (!loggerConfig.output) {
171165
loggerConfig.output = stderr;

test/utils/utils_log.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ FILE *mock_fopen(const char *filename, const char *mode) {
1717
return MOCK_FILE_PTR;
1818
}
1919

20-
int mock_fopen_s(FILE **f, const char *filename, const char *mode) {
21-
*f = mock_fopen(filename, mode);
22-
23-
return 0;
24-
}
25-
2620
std::string expected_message = "";
2721
FILE *expected_stream;
2822
int expect_fput_count = 0;
@@ -64,7 +58,6 @@ int mock_util_env_var(const char *envvar, char *buffer, size_t buffer_size) {
6458
}
6559

6660
#define fopen(A, B) mock_fopen(A, B)
67-
#define fopen_s(A, B, C) mock_fopen_s(A, B, C)
6861
#define fputs(A, B) mock_fputs(A, B)
6962
#define fflush(A) mock_fflush(A)
7063
#define util_env_var(A, B, C) mock_util_env_var(A, B, C)

0 commit comments

Comments
 (0)