summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2018-09-21 15:35:50 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-09-21 15:35:50 +0000
commitf8120a1c91e17c63c4545f07210a1e11d21dcc1c (patch)
treef654a3aefcfc903de035650e44bce147593ab7fe
parent7ee67be05356a74bc993b7afa67439cb2f6c6a57 (diff)
parentc74d9cbd4c7b1b5b1a4c5a6bb34e9426336bbecc (diff)
Merge "ART: Modernize counting-down loops"
-rw-r--r--compiler/utils/mips/assembler_mips.cc2
-rw-r--r--compiler/utils/mips64/assembler_mips64.cc2
-rw-r--r--dexdump/dexdump.cc2
-rw-r--r--dexlayout/dexlayout.cc2
-rw-r--r--libdexfile/dex/dex_file_verifier.cc10
-rw-r--r--runtime/dex/dex_file_annotations.cc4
6 files changed, 11 insertions, 11 deletions
diff --git a/compiler/utils/mips/assembler_mips.cc b/compiler/utils/mips/assembler_mips.cc
index c0b6f988d4..1ba535f4c3 100644
--- a/compiler/utils/mips/assembler_mips.cc
+++ b/compiler/utils/mips/assembler_mips.cc
@@ -3610,7 +3610,7 @@ void MipsAssembler::FinalizeLabeledBranch(MipsLabel* label) {
label->LinkTo(branch_id);
}
// Reserve space for the branch.
- while (length--) {
+ for (; length != 0u; --length) {
Nop();
}
}
diff --git a/compiler/utils/mips64/assembler_mips64.cc b/compiler/utils/mips64/assembler_mips64.cc
index 5b1c5d9e01..6df9562fd5 100644
--- a/compiler/utils/mips64/assembler_mips64.cc
+++ b/compiler/utils/mips64/assembler_mips64.cc
@@ -2889,7 +2889,7 @@ void Mips64Assembler::FinalizeLabeledBranch(Mips64Label* label) {
label->LinkTo(branch_id);
}
// Reserve space for the branch.
- while (length--) {
+ for (; length != 0u; --length) {
Nop();
}
}
diff --git a/dexdump/dexdump.cc b/dexdump/dexdump.cc
index 2cf05678c6..f09d448493 100644
--- a/dexdump/dexdump.cc
+++ b/dexdump/dexdump.cc
@@ -331,7 +331,7 @@ static char* createAccessFlagStr(u4 flags, AccessFor forWhat) {
* NULL-terminated.
*/
static void asciify(char* out, const unsigned char* data, size_t len) {
- while (len--) {
+ for (; len != 0u; --len) {
if (*data < 0x20) {
// Could do more here, but we don't need them yet.
switch (*data) {
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc
index b539f5d130..1b8412d86a 100644
--- a/dexlayout/dexlayout.cc
+++ b/dexlayout/dexlayout.cc
@@ -247,7 +247,7 @@ static std::string GetSignatureForProtoId(const dex_ir::ProtoId* proto) {
* NULL-terminated.
*/
static void Asciify(char* out, const unsigned char* data, size_t len) {
- while (len--) {
+ for (; len != 0u; --len) {
if (*data < 0x20) {
// Could do more here, but we don't need them yet.
switch (*data) {
diff --git a/libdexfile/dex/dex_file_verifier.cc b/libdexfile/dex/dex_file_verifier.cc
index fd011c86d1..f273c84027 100644
--- a/libdexfile/dex/dex_file_verifier.cc
+++ b/libdexfile/dex/dex_file_verifier.cc
@@ -866,7 +866,7 @@ bool DexFileVerifier::CheckEncodedValue() {
bool DexFileVerifier::CheckEncodedArray() {
DECODE_UNSIGNED_CHECKED_FROM(ptr_, size);
- while (size--) {
+ for (; size != 0u; --size) {
if (!CheckEncodedValue()) {
failure_reason_ = StringPrintf("Bad encoded_array value: %s", failure_reason_.c_str());
return false;
@@ -1304,7 +1304,7 @@ bool DexFileVerifier::CheckIntraCodeItem() {
}
uint32_t last_addr = 0;
- while (try_items_size--) {
+ for (; try_items_size != 0u; --try_items_size) {
if (UNLIKELY(try_items->start_addr_ < last_addr)) {
ErrorStringPrintf("Out-of_order try_item with start_addr: %x", try_items->start_addr_);
return false;
@@ -1884,7 +1884,7 @@ bool DexFileVerifier::CheckIntraSection() {
ptr_ = begin_;
// Check the items listed in the map.
- while (count--) {
+ for (; count != 0u; --count) {
const size_t current_offset = offset;
uint32_t section_offset = item->offset_;
uint32_t section_count = item->size_;
@@ -2554,7 +2554,7 @@ bool DexFileVerifier::CheckInterAnnotationSetRefList() {
const DexFile::AnnotationSetRefItem* item = list->list_;
uint32_t count = list->size_;
- while (count--) {
+ for (; count != 0u; --count) {
if (item->annotations_off_ != 0 &&
!CheckOffsetToTypeMap(item->annotations_off_, DexFile::kDexTypeAnnotationSetItem)) {
return false;
@@ -2839,7 +2839,7 @@ bool DexFileVerifier::CheckInterSection() {
uint32_t count = map->size_;
// Cross check the items listed in the map.
- while (count--) {
+ for (; count != 0u; --count) {
uint32_t section_offset = item->offset_;
uint32_t section_count = item->size_;
DexFile::MapItemType type = static_cast<DexFile::MapItemType>(item->type_);
diff --git a/runtime/dex/dex_file_annotations.cc b/runtime/dex/dex_file_annotations.cc
index 51cfd43fd1..b50a430843 100644
--- a/runtime/dex/dex_file_annotations.cc
+++ b/runtime/dex/dex_file_annotations.cc
@@ -209,7 +209,7 @@ bool SkipAnnotationValue(const DexFile& dex_file, const uint8_t** annotation_ptr
case DexFile::kDexAnnotationArray:
{
uint32_t size = DecodeUnsignedLeb128(&annotation);
- while (size--) {
+ for (; size != 0u; --size) {
if (!SkipAnnotationValue(dex_file, &annotation)) {
return false;
}
@@ -221,7 +221,7 @@ bool SkipAnnotationValue(const DexFile& dex_file, const uint8_t** annotation_ptr
{
DecodeUnsignedLeb128(&annotation); // unused type_index
uint32_t size = DecodeUnsignedLeb128(&annotation);
- while (size--) {
+ for (; size != 0u; --size) {
DecodeUnsignedLeb128(&annotation); // unused element_name_index
if (!SkipAnnotationValue(dex_file, &annotation)) {
return false;