mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-20 05:20:28 +00:00
Keep MSVC happy with secure versions of C calls
This commit is contained in:
@@ -17,11 +17,11 @@ gb_internal bool recursively_delete_directory(wchar_t *wpath_c) {
|
||||
|
||||
wchar_t dir_path[MAX_PATH] = {};
|
||||
wchar_t filename[MAX_PATH] = {};
|
||||
wcscpy(dir_path, wpath_c);
|
||||
wcscat(dir_path, L"\\*");
|
||||
wcscpy_s(dir_path, wpath_c);
|
||||
wcscat_s(dir_path, L"\\*");
|
||||
|
||||
wcscpy(filename, wpath_c);
|
||||
wcscat(filename, L"\\");
|
||||
wcscpy_s(filename, wpath_c);
|
||||
wcscat_s(filename, L"\\");
|
||||
|
||||
|
||||
WIN32_FIND_DATAW find_file_data = {};
|
||||
@@ -31,21 +31,21 @@ gb_internal bool recursively_delete_directory(wchar_t *wpath_c) {
|
||||
}
|
||||
defer (FindClose(hfind));
|
||||
|
||||
wcscpy(dir_path, filename);
|
||||
wcscpy_s(dir_path, filename);
|
||||
|
||||
for (;;) {
|
||||
if (FindNextFileW(hfind, &find_file_data)) {
|
||||
if (is_dots_w(find_file_data.cFileName)) {
|
||||
continue;
|
||||
}
|
||||
wcscat(filename, find_file_data.cFileName);
|
||||
wcscat_s(filename, find_file_data.cFileName);
|
||||
|
||||
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
if (!recursively_delete_directory(filename)) {
|
||||
return false;
|
||||
}
|
||||
RemoveDirectoryW(filename);
|
||||
wcscpy(filename, dir_path);
|
||||
wcscpy_s(filename, dir_path);
|
||||
} else {
|
||||
if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
|
||||
_wchmod(filename, _S_IWRITE);
|
||||
@@ -53,7 +53,7 @@ gb_internal bool recursively_delete_directory(wchar_t *wpath_c) {
|
||||
if (!DeleteFileW(filename)) {
|
||||
return false;
|
||||
}
|
||||
wcscpy(filename, dir_path);
|
||||
wcscpy_s(filename, dir_path);
|
||||
}
|
||||
} else {
|
||||
if (GetLastError() == ERROR_NO_MORE_FILES) {
|
||||
|
||||
@@ -1117,7 +1117,11 @@ gb_internal void init_universal(void) {
|
||||
int minimum_os_version = 0;
|
||||
if (build_context.minimum_os_version_string != "") {
|
||||
int major, minor, revision = 0;
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
sscanf_s(cast(const char *)(build_context.minimum_os_version_string.text), "%d.%d.%d", &major, &minor, &revision);
|
||||
#else
|
||||
sscanf(cast(const char *)(build_context.minimum_os_version_string.text), "%d.%d.%d", &major, &minor, &revision);
|
||||
#endif
|
||||
minimum_os_version = (major*10000)+(minor*100)+revision;
|
||||
}
|
||||
add_global_constant("ODIN_MINIMUM_OS_VERSION", t_untyped_integer, exact_value_i64(minimum_os_version));
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#undef NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define GB_WINDOWS_H_INCLUDED
|
||||
#define GB_IMPLEMENTATION
|
||||
#include "gb/gb.h"
|
||||
|
||||
10
src/main.cpp
10
src/main.cpp
@@ -399,8 +399,6 @@ enum BuildFlagKind {
|
||||
|
||||
BuildFlag_Sanitize,
|
||||
|
||||
BuildFlag_FastBuild,
|
||||
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
BuildFlag_IgnoreVsSearch,
|
||||
BuildFlag_ResourceFile,
|
||||
@@ -607,8 +605,6 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
||||
|
||||
add_flag(&build_flags, BuildFlag_Sanitize, str_lit("sanitize"), BuildFlagParam_String, Command__does_build, true);
|
||||
|
||||
add_flag(&build_flags, BuildFlag_FastBuild, str_lit("fast-build"), BuildFlagParam_None, Command__does_build);
|
||||
|
||||
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
add_flag(&build_flags, BuildFlag_IgnoreVsSearch, str_lit("ignore-vs-search"), BuildFlagParam_None, Command__does_build);
|
||||
@@ -1447,12 +1443,6 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
||||
break;
|
||||
|
||||
|
||||
case BuildFlag_FastBuild:
|
||||
build_context.custom_optimization_level = true;
|
||||
build_context.optimization_level = -1;
|
||||
build_context.use_separate_modules = true;
|
||||
break;
|
||||
|
||||
#if defined(GB_SYSTEM_WINDOWS)
|
||||
case BuildFlag_IgnoreVsSearch: {
|
||||
GB_ASSERT(value.kind == ExactValue_Invalid);
|
||||
|
||||
Reference in New Issue
Block a user