Bug 1546587 - Modernize loops in TestZip. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 25 Apr 2019 23:41:45 +0000
changeset 530211 28c357e15e37131b9736076f5cca95420935bbe0
parent 530210 3791fc50da340ff41e78eedf892454b395e47617
child 530212 a18a147e0dee0c192075eb15f4f742c41c3153f0
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1546587
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1546587 - Modernize loops in TestZip. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D28757
mozglue/linker/tests/TestZip.cpp
--- a/mozglue/linker/tests/TestZip.cpp
+++ b/mozglue/linker/tests/TestZip.cpp
@@ -39,36 +39,34 @@ int main(int argc, char *argv[]) {
     fprintf(
         stderr,
         "TEST-FAIL | TestZip | Expecting the directory containing test Zips\n");
     return 1;
   }
   chdir(argv[1]);
   Zip::Stream s;
   RefPtr<Zip> z = ZipCollection::GetZip("test.zip");
-  for (size_t i = 0; i < sizeof(test_entries) / sizeof(*test_entries); i++) {
-    if (!z->GetStream(test_entries[i], &s)) {
+  for (auto& entry : test_entries) {
+    if (!z->GetStream(entry, &s)) {
       fprintf(stderr,
               "TEST-UNEXPECTED-FAIL | TestZip | test.zip: Couldn't get entry "
               "\"%s\"\n",
-              test_entries[i]);
+              entry);
       return 1;
     }
   }
   fprintf(stderr, "TEST-PASS | TestZip | test.zip could be accessed fully\n");
 
   z = ZipCollection::GetZip("no_central_dir.zip");
-  for (size_t i = 0;
-       i < sizeof(no_central_dir_entries) / sizeof(*no_central_dir_entries);
-       i++) {
-    if (!z->GetStream(no_central_dir_entries[i], &s)) {
+  for (auto& entry : no_central_dir_entries) {
+    if (!z->GetStream(entry, &s)) {
       fprintf(stderr,
               "TEST-UNEXPECTED-FAIL | TestZip | no_central_dir.zip: Couldn't "
               "get entry \"%s\"\n",
-              no_central_dir_entries[i]);
+              entry);
       return 1;
     }
   }
   fprintf(
       stderr,
       "TEST-PASS | TestZip | no_central_dir.zip could be accessed in order\n");
 
   return 0;