diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2017-11-19 17:34:27 +0300 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-11-30 06:08:50 +0000 |
commit | 4f6ec935e3abe5c918c320501a75786cce5d2ed0 (patch) | |
tree | ab22024081f6e4d693ad988efa136eefe4410c41 /src/shared/json | |
parent | a3c85aa9f267c156cd9b71a389eb4efe460439c8 (diff) |
Modernize variable declarations
Use 'const' and 'auto' keywords more where static_cast is used.
Change-Id: I60152b90fe5e44aa1ca513b43f133e604ed6417f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/shared/json')
-rw-r--r-- | src/shared/json/json.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/shared/json/json.cpp b/src/shared/json/json.cpp index c84eb560c..95c1fbcdf 100644 --- a/src/shared/json/json.cpp +++ b/src/shared/json/json.cpp @@ -4621,11 +4621,11 @@ void Data::compact() Base *base = header->root(); int reserve = 0; if (base->is_object) { - Object *o = static_cast<Object *>(base); + const auto o = static_cast<Object *>(base); for (int i = 0; i < (int)o->length; ++i) reserve += o->entryAt(i)->usedStorage(o); } else { - Array *a = static_cast<Array *>(base); + const auto a = static_cast<Array *>(base); for (int i = 0; i < (int)a->length; ++i) reserve += (*a)[i].usedStorage(a); } @@ -4643,8 +4643,8 @@ void Data::compact() int offset = sizeof(Base); if (b->is_object) { - Object *o = static_cast<Object *>(base); - Object *no = static_cast<Object *>(b); + const auto o = static_cast<const Object *>(base); + const auto no = static_cast<const Object *>(b); for (int i = 0; i < (int)o->length; ++i) { no->table()[i] = offset; @@ -4662,8 +4662,8 @@ void Data::compact() } } } else { - Array *a = static_cast<Array *>(base); - Array *na = static_cast<Array *>(b); + const auto a = static_cast<Array *>(base); + const auto na = static_cast<Array *>(b); for (int i = 0; i < (int)a->length; ++i) { const Value &v = (*a)[i]; |