Enable clang-tidy bugprone-too-small-loop-variable

And fixes for it in the code
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 71b4e5c..42bdb89 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -40,7 +40,7 @@
   script:
     - git clone --branch ${CI_COMMIT_REF_NAME} --depth 1 ${TEST_DATA_URL} test-data || git clone --depth 1 ${UPSTREAM_TEST_DATA_URL} test-data
     - mkdir -p build && cd build
-    - CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*;-warnings-as-errors=*" ..
+    - CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*,bugprone-too-small-loop-variable;-warnings-as-errors=*" ..
     - ninja
     - ctest --output-on-failure
 
diff --git a/cpp/tests/poppler-dump.cpp b/cpp/tests/poppler-dump.cpp
index cdd515d..395802b 100644
--- a/cpp/tests/poppler-dump.cpp
+++ b/cpp/tests/poppler-dump.cpp
@@ -103,8 +103,8 @@
 static std::ostream& operator<<(std::ostream& stream, const poppler::ustring &str)
 {
     const poppler::byte_array ba = str.to_utf8();
-    for (unsigned int i = 0; i < ba.size(); ++i) {
-        stream << (char)(ba[i]);
+    for (const char c : ba) {
+        stream << c;
     }
     return stream;
 }
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 843be83..fbeaf34 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1829,7 +1829,7 @@
 
       *n_ranges = ranges.size ();
       result = g_new (PopplerPageRange, ranges.size ());
-      for (guint i = 0; i < ranges.size (); ++i) {
+      for (size_t i = 0; i < ranges.size (); ++i) {
         result[i].start_page = ranges[i].first;
         result[i].end_page = ranges[i].second;
       }
diff --git a/poppler/Form.cc b/poppler/Form.cc
index b1231e1..0752152 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -585,7 +585,7 @@
             }
             if (sigLen > 0 && 2*(sigLen+lenBytes) <= len-4)
             {
-              for (int i = 2*(sigLen+lenBytes)+4; i < len; ++i)
+              for (Goffset i = 2*(sigLen+lenBytes)+4; i < len; ++i)
               {
                 if (gstr.getChar(i) != '0')
                 {
@@ -598,9 +598,9 @@
               len = 0;
           }
         }
-        for (int i = 0; i < len; ++i)
+        for ( const char c : gstr.toStr() )
         {
-          if (!isxdigit(gstr.getChar(i)))
+          if (!isxdigit(c))
             len = 0;
         }
         if (len > 0)
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 52fd822..1302e4e 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1547,7 +1547,7 @@
   }
   if(title) {
     char *sanitizedTitle = strdup(title);
-    for (unsigned int i = 0; i < strlen(sanitizedTitle); ++i) {
+    for (size_t i = 0; i < strlen(sanitizedTitle); ++i) {
       if (sanitizedTitle[i] == '\n' || sanitizedTitle[i] == '\r') {
         sanitizedTitle[i] = ' ';
       }
@@ -2108,8 +2108,8 @@
 void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) {
   static const char hexChar[17] = "0123456789abcdef";
   Dict *dict;
-  long length1, length2, length3;
-  int c, i;
+  long length1, length2, length3, i;
+  int c;
   int start[4];
   bool binMode;
   bool writePadding = true;
diff --git a/poppler/StructElement.cc b/poppler/StructElement.cc
index 3ad314c..cdfb3c2 100644
--- a/poppler/StructElement.cc
+++ b/poppler/StructElement.cc
@@ -471,9 +471,9 @@
 
 static bool ownerHasMorePriority(Attribute::Owner a, Attribute::Owner b)
 {
-  unsigned aIndex, bIndex;
+  size_t aIndex, bIndex, i;
 
-  for (unsigned i = aIndex = bIndex = 0; i < sizeof(ownerMap) / sizeof(ownerMap[0]); i++) {
+  for (i = aIndex = bIndex = 0; i < sizeof(ownerMap) / sizeof(ownerMap[0]); i++) {
     if (ownerMap[i].owner == a)
       aIndex = i;
     if (ownerMap[i].owner == b)
diff --git a/qt5/src/poppler-document.cc b/qt5/src/poppler-document.cc
index 9443b3e..ba9b86c 100644
--- a/qt5/src/poppler-document.cc
+++ b/qt5/src/poppler-document.cc
@@ -806,8 +806,8 @@
 
         Form *form = m_doc->doc->getCatalog()->getForm();
         const std::vector<Ref> &calculateOrder = form->getCalculateOrder();
-        for (uint i = 0; i < calculateOrder.size(); ++i) {
-            FormWidget *w = form->findWidgetByRef(calculateOrder[i]);
+        for (Ref r : calculateOrder) {
+            FormWidget *w = form->findWidgetByRef(r);
             if (w) {
                 result << w->getID();
             }
diff --git a/splash/SplashXPathScanner.cc b/splash/SplashXPathScanner.cc
index 042a6ef..4ca90bc 100644
--- a/splash/SplashXPathScanner.cc
+++ b/splash/SplashXPathScanner.cc
@@ -129,9 +129,9 @@
   if (!line.empty()) {
     *spanXMin = line[0].x0;
     int xx = line[0].x1;
-    for (unsigned int i = 1; i < line.size(); ++i) {
-      if (line[i].x1 > xx) {
-	xx = line[i].x1;
+    for (const SplashIntersect &intersect : line) {
+      if (intersect.x1 > xx) {
+	xx = intersect.x1;
       }
     }
     *spanXMax = xx;