From 4f6ec935e3abe5c918c320501a75786cce5d2ed0 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Sun, 19 Nov 2017 17:34:27 +0300 Subject: Modernize variable declarations Use 'const' and 'auto' keywords more where static_cast is used. Change-Id: I60152b90fe5e44aa1ca513b43f133e604ed6417f Reviewed-by: Jake Petroules Reviewed-by: Denis Shienkov --- src/shared/json/json.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/shared') 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(base); + const auto o = static_cast(base); for (int i = 0; i < (int)o->length; ++i) reserve += o->entryAt(i)->usedStorage(o); } else { - Array *a = static_cast(base); + const auto a = static_cast(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(base); - Object *no = static_cast(b); + const auto o = static_cast(base); + const auto no = static_cast(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(base); - Array *na = static_cast(b); + const auto a = static_cast(base); + const auto na = static_cast(b); for (int i = 0; i < (int)a->length; ++i) { const Value &v = (*a)[i]; -- cgit v1.2.3