From bd7255e095d461ee26625e7259b7dbc5ae3ca8ba Mon Sep 17 00:00:00 2001 From: Sammy Newhide Date: Mon, 5 May 2025 15:15:04 -0700 Subject: [PATCH 1/3] Initialize Accessor::Sparse members to default values --- tiny_gltf.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index 0eedd65..b0eac71 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -834,20 +834,20 @@ struct Accessor { maxValues; // optional. integer value is promoted to double struct Sparse { - int count; - bool isSparse; + int count{0}; + bool isSparse{false}; struct { - size_t byteOffset; - int bufferView; - int componentType; // a TINYGLTF_COMPONENT_TYPE_ value + size_t byteOffset{0}; + int bufferView{-1}; + int componentType{-1}; // a TINYGLTF_COMPONENT_TYPE_ value Value extras; ExtensionMap extensions; std::string extras_json_string; std::string extensions_json_string; } indices; struct { - int bufferView; - size_t byteOffset; + int bufferView{-1}; + size_t byteOffset{0}; Value extras; ExtensionMap extensions; std::string extras_json_string; @@ -898,11 +898,7 @@ struct Accessor { // unreachable return 0; } - Accessor() - - { - sparse.isSparse = false; - } + Accessor() = default; DEFAULT_METHODS(Accessor) bool operator==(const tinygltf::Accessor &) const; }; From 1b517f2b23036e23f8c28d35ab2594ae8398e296 Mon Sep 17 00:00:00 2001 From: Sammy Newhide Date: Mon, 5 May 2025 16:43:20 -0700 Subject: [PATCH 2/3] Remove explicit default constructor for Accessor Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tiny_gltf.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index b0eac71..e9a7ebc 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -898,7 +898,6 @@ struct Accessor { // unreachable return 0; } - Accessor() = default; DEFAULT_METHODS(Accessor) bool operator==(const tinygltf::Accessor &) const; }; From 2ad433b68ff2cf596464ebc898132d123fbf5556 Mon Sep 17 00:00:00 2001 From: Sammy Newhide Date: Mon, 5 May 2025 17:04:52 -0700 Subject: [PATCH 3/3] Revert 1b517f2 by adding default constructor for Accessor --- tiny_gltf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tiny_gltf.h b/tiny_gltf.h index e9a7ebc..b0eac71 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -898,6 +898,7 @@ struct Accessor { // unreachable return 0; } + Accessor() = default; DEFAULT_METHODS(Accessor) bool operator==(const tinygltf::Accessor &) const; };