From c85ba8ff4b2531c4331e876cb2fad0234c23044d Mon Sep 17 00:00:00 2001 From: Brian Nichols Date: Fri, 16 Feb 2024 14:05:35 -0500 Subject: [PATCH] Use cf_calloc to initialize as_metrics_writer struct. Ignore certain Visual Studio warning messages. --- src/main/aerospike/as_metrics_writer.c | 8 +------- vs/aerospike/aerospike.vcxproj | 2 ++ vs/aerospike/aerospike.vcxproj.filters | 6 ++++++ vs/props/base.props | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/aerospike/as_metrics_writer.c b/src/main/aerospike/as_metrics_writer.c index df1f9b456..1003190d8 100644 --- a/src/main/aerospike/as_metrics_writer.c +++ b/src/main/aerospike/as_metrics_writer.c @@ -593,11 +593,9 @@ as_metrics_writer_create(as_error* err, const as_metrics_policy* policy, as_metr "Metrics policy report_size_limit %" PRIu64 " must be at least %d", policy->report_size_limit, MIN_FILE_SIZE); } - as_metrics_writer* mw = cf_malloc(sizeof(as_metrics_writer)); + as_metrics_writer* mw = cf_calloc(1, sizeof(as_metrics_writer)); as_strncpy(mw->report_dir, policy->report_dir, sizeof(mw->report_dir)); - mw->file = NULL; mw->max_size = policy->report_size_limit; - mw->size = 0; mw->latency_columns = policy->latency_columns; mw->latency_shift = policy->latency_shift; mw->enable = false; @@ -605,10 +603,6 @@ as_metrics_writer_create(as_error* err, const as_metrics_policy* policy, as_metr #ifdef _MSC_VER mw->pid = GetCurrentProcessId(); mw->process = OpenProcess(PROCESS_QUERY_INFORMATION, false, mw->pid); - mw->prev_process_times_kernel = 0; - mw->prev_process_times_user = 0; - mw->prev_system_times_kernel = 0; - mw->prev_system_times_user = 0; FILETIME dummy; if (mw->process != NULL) diff --git a/vs/aerospike/aerospike.vcxproj b/vs/aerospike/aerospike.vcxproj index 113721ead..6f483659c 100644 --- a/vs/aerospike/aerospike.vcxproj +++ b/vs/aerospike/aerospike.vcxproj @@ -399,6 +399,7 @@ + @@ -551,6 +552,7 @@ + diff --git a/vs/aerospike/aerospike.vcxproj.filters b/vs/aerospike/aerospike.vcxproj.filters index 0d375a016..cdb86cd2f 100644 --- a/vs/aerospike/aerospike.vcxproj.filters +++ b/vs/aerospike/aerospike.vcxproj.filters @@ -498,6 +498,9 @@ Header Files + + Header Files + @@ -947,6 +950,9 @@ Source Files + + Source Files + diff --git a/vs/props/base.props b/vs/props/base.props index 5f458bb22..ad6ec7d48 100644 --- a/vs/props/base.props +++ b/vs/props/base.props @@ -8,7 +8,7 @@ _CRT_SECURE_NO_DEPRECATE;_TIMESPEC_DEFINED;%(PreprocessorDefinitions) - 4098;4996 + 4098;4996;6255;6262;26451