mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-04-20 13:09:59 +08:00
Merge pull request #481 from jam3sward/fix-c4267-warnings-vs-win32
Fix C4267 warnings in Visual Studio on WIN32
This commit is contained in:
commit
ed3d1ec2f5
15
tiny_gltf.h
15
tiny_gltf.h
@ -337,12 +337,11 @@ class Value {
|
|||||||
T &Get();
|
T &Get();
|
||||||
|
|
||||||
// Lookup value from an array
|
// Lookup value from an array
|
||||||
const Value &Get(int idx) const {
|
const Value &Get(size_t idx) const {
|
||||||
static Value null_value;
|
static Value null_value;
|
||||||
assert(IsArray());
|
assert(IsArray());
|
||||||
assert(idx >= 0);
|
return (idx < array_value_.size())
|
||||||
return (static_cast<size_t>(idx) < array_value_.size())
|
? array_value_[idx]
|
||||||
? array_value_[static_cast<size_t>(idx)]
|
|
||||||
: null_value;
|
: null_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1927,7 +1926,7 @@ static bool Equals(const tinygltf::Value &one, const tinygltf::Value &other) {
|
|||||||
}
|
}
|
||||||
case ARRAY_TYPE: {
|
case ARRAY_TYPE: {
|
||||||
if (one.Size() != other.Size()) return false;
|
if (one.Size() != other.Size()) return false;
|
||||||
for (int i = 0; i < int(one.Size()); ++i)
|
for (size_t i = 0; i < one.Size(); ++i)
|
||||||
if (!Equals(one.Get(i), other.Get(i))) return false;
|
if (!Equals(one.Get(i), other.Get(i))) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -7070,10 +7069,10 @@ static bool ValueToJson(const Value &value, detail::json *ret) {
|
|||||||
obj = detail::json(value.Get<std::string>());
|
obj = detail::json(value.Get<std::string>());
|
||||||
break;
|
break;
|
||||||
case ARRAY_TYPE: {
|
case ARRAY_TYPE: {
|
||||||
for (unsigned int i = 0; i < value.ArrayLen(); ++i) {
|
for (size_t i = 0; i < value.ArrayLen(); ++i) {
|
||||||
Value elementValue = value.Get(int(i));
|
Value elementValue = value.Get(i);
|
||||||
detail::json elementJson;
|
detail::json elementJson;
|
||||||
if (ValueToJson(value.Get(int(i)), &elementJson))
|
if (ValueToJson(value.Get(i), &elementJson))
|
||||||
obj.push_back(elementJson);
|
obj.push_back(elementJson);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user