Skip to content

Commit a6a8cec

Browse files
jijinbeiclaude
andcommitted
Coding - Cast RWGltf_GltfRootElement to int for array size/subscript
macOS Clang reports value-not-implicitly-convertible-to-unsigned-long for the static THE_ROOT_NAMES array size and the return subscript; wrap the enum class value with static_cast<int>() at three sites (RWGltf_GltfRootElement.hxx array declaration and subscript, RWGltf_GltfJsonParser.hxx member array size). The secondary ParseStream errors in RWGltf_CafReader are a downstream instantiation failure that resolves once the parser header compiles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a3f6ec3 commit a6a8cec

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfJsonParser.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ protected:
522522
// clang-format on
523523

524524
#ifdef HAVE_RAPIDJSON
525-
GltfElementMap
526-
myGltfRoots[RWGltf_GltfRootElement::RWGltf_GltfRootElement_NB]; //!< glTF format root elements
525+
GltfElementMap myGltfRoots[static_cast<int>(
526+
RWGltf_GltfRootElement::RWGltf_GltfRootElement_NB)]; //!< glTF format root elements
527527
#endif
528528
};
529529

src/DataExchange/TKDEGLTF/RWGltf/RWGltf_GltfRootElement.hxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ enum class RWGltf_GltfRootElement
4545
//! Root elements within glTF JSON document - names array.
4646
inline const char* RWGltf_GltfRootElementName(RWGltf_GltfRootElement theElem)
4747
{
48-
static const char* THE_ROOT_NAMES[RWGltf_GltfRootElement::RWGltf_GltfRootElement_NB] = {
48+
static const char* THE_ROOT_NAMES[static_cast<int>(
49+
RWGltf_GltfRootElement::RWGltf_GltfRootElement_NB)] = {
4950
"asset",
5051
"scenes",
5152
"scene",
@@ -65,7 +66,7 @@ inline const char* RWGltf_GltfRootElementName(RWGltf_GltfRootElement theElem)
6566
"images",
6667
"extensionsUsed",
6768
"extensionsRequired"};
68-
return THE_ROOT_NAMES[theElem];
69+
return THE_ROOT_NAMES[static_cast<int>(theElem)];
6970
}
7071

7172
#endif // _RWGltf_GltfRootElement_HeaderFile

0 commit comments

Comments
 (0)