From e487372b8392d7e4e2f0cf8dd77153cd7d3d944e Mon Sep 17 00:00:00 2001 From: KiterLuc <67824247+KiterLuc@users.noreply.github.com> Date: Tue, 17 Oct 2023 14:56:26 +0200 Subject: [PATCH] Fix unintialized variables in nightly build. (#4428) --- TYPE: NO_HISTORY DESC: Fix unintialized variables in nightly build. --- .../query_field/test/unit_capi_query_field.cc | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tiledb/api/c_api/query_field/test/unit_capi_query_field.cc b/tiledb/api/c_api/query_field/test/unit_capi_query_field.cc index 7c540fa1b4b..52321606ca7 100644 --- a/tiledb/api/c_api/query_field/test/unit_capi_query_field.cc +++ b/tiledb/api/c_api/query_field/test/unit_capi_query_field.cc @@ -123,10 +123,10 @@ void QueryFieldFx::create_sparse_array(const std::string& array_name) { uint64_t tile_extents[] = {2, 2}; uint64_t dim_domain[] = {1, 10, 1, 10}; - tiledb_dimension_t* d1; + tiledb_dimension_t* d1 = nullptr; throw_if_setup_failed(tiledb_dimension_alloc( ctx, "d1", TILEDB_UINT64, &dim_domain[0], &tile_extents[0], &d1)); - tiledb_dimension_t* d2; + tiledb_dimension_t* d2 = nullptr; throw_if_setup_failed(tiledb_dimension_alloc( ctx, "d2", TILEDB_UINT64, &dim_domain[2], &tile_extents[1], &d2)); @@ -137,23 +137,23 @@ void QueryFieldFx::create_sparse_array(const std::string& array_name) { throw_if_setup_failed(tiledb_domain_add_dimension(ctx, domain, d2)); // Create attributes - tiledb_attribute_t* a; + tiledb_attribute_t* a = nullptr; throw_if_setup_failed(tiledb_attribute_alloc(ctx, "a", TILEDB_INT32, &a)); - tiledb_attribute_t* b; + tiledb_attribute_t* b = nullptr; throw_if_setup_failed(tiledb_attribute_alloc(ctx, "b", TILEDB_INT32, &b)); - tiledb_attribute_t* c; + tiledb_attribute_t* c = nullptr; throw_if_setup_failed( tiledb_attribute_alloc(ctx, "c", TILEDB_STRING_ASCII, &c)); throw_if_setup_failed( tiledb_attribute_set_cell_val_num(ctx, c, TILEDB_VAR_NUM)); - tiledb_attribute_t* d; + tiledb_attribute_t* d = nullptr; throw_if_setup_failed( tiledb_attribute_alloc(ctx, "d", TILEDB_STRING_UTF8, &d)); throw_if_setup_failed( tiledb_attribute_set_cell_val_num(ctx, d, TILEDB_VAR_NUM)); // Create array schema - tiledb_array_schema_t* array_schema; + tiledb_array_schema_t* array_schema = nullptr; throw_if_setup_failed( tiledb_array_schema_alloc(ctx, TILEDB_SPARSE, &array_schema)); throw_if_setup_failed( @@ -192,11 +192,13 @@ TEST_CASE_METHOD( QueryFieldFx, "C API: argument validation", "[capi][query_field][get][args]") { - tiledb_array_t* array; + tiledb_array_t* array = nullptr; + ; REQUIRE(tiledb_array_alloc(ctx, array_name().c_str(), &array) == TILEDB_OK); REQUIRE(tiledb_array_open(ctx, array, TILEDB_READ) == TILEDB_OK); - tiledb_query_t* query; + tiledb_query_t* query = nullptr; + ; REQUIRE(tiledb_query_alloc(ctx, array, TILEDB_READ, &query) == TILEDB_OK); tiledb_query_field_t* field = nullptr; @@ -231,11 +233,13 @@ TEST_CASE_METHOD( QueryFieldFx, "C API: argument validation", "[capi][query_field][access][args]") { - tiledb_array_t* array; + tiledb_array_t* array = nullptr; + ; REQUIRE(tiledb_array_alloc(ctx, array_name().c_str(), &array) == TILEDB_OK); REQUIRE(tiledb_array_open(ctx, array, TILEDB_READ) == TILEDB_OK); - tiledb_query_t* query; + tiledb_query_t* query = nullptr; + ; REQUIRE(tiledb_query_alloc(ctx, array, TILEDB_READ, &query) == TILEDB_OK); tiledb_query_field_t* field = nullptr; @@ -282,11 +286,11 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( QueryFieldFx, "C API: argument validation", "[capi][query_field]") { - tiledb_array_t* array; + tiledb_array_t* array = nullptr; REQUIRE(tiledb_array_alloc(ctx, array_name().c_str(), &array) == TILEDB_OK); REQUIRE(tiledb_array_open(ctx, array, TILEDB_READ) == TILEDB_OK); - tiledb_query_t* query; + tiledb_query_t* query = nullptr; REQUIRE(tiledb_query_alloc(ctx, array, TILEDB_READ, &query) == TILEDB_OK); REQUIRE(tiledb_query_set_layout(ctx, query, TILEDB_UNORDERED) == TILEDB_OK);