cmELF: Use size_t for container size
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 372fb9b..36026a6 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -103,7 +103,7 @@
   virtual ~cmELFInternal() = default;
 
   // Forward to the per-class implementation.
-  virtual unsigned int GetNumberOfSections() const = 0;
+  virtual std::size_t GetNumberOfSections() const = 0;
   virtual unsigned long GetDynamicEntryPosition(int j) = 0;
   virtual cmELF::DynamicEntryList GetDynamicEntries() = 0;
   virtual std::vector<char> EncodeDynamicEntries(
@@ -213,7 +213,7 @@
                     ByteOrderType order);
 
   // Return the number of sections as specified by the ELF header.
-  unsigned int GetNumberOfSections() const override
+  std::size_t GetNumberOfSections() const override
   {
     return static_cast<unsigned int>(this->ELFHeader.e_shnum +
                                      this->SectionHeaders[0].sh_size);
@@ -371,7 +371,7 @@
     return !this->Stream->fail();
   }
 
-  bool LoadSectionHeader(unsigned int i)
+  bool LoadSectionHeader(std::size_t i)
   {
     // Read the section header from the file.
     this->Stream->seekg(this->ELFHeader.e_shoff +
@@ -452,7 +452,7 @@
     this->ELFHeader.e_shnum == 0 ? 1 : this->ELFHeader.e_shnum);
   this->LoadSectionHeader(0);
   this->SectionHeaders.resize(this->GetNumberOfSections());
-  for (unsigned int i = 1; i < this->GetNumberOfSections(); ++i) {
+  for (std::size_t i = 1; i < this->GetNumberOfSections(); ++i) {
     if (!this->LoadSectionHeader(i)) {
       this->SetErrorMessage("Failed to load section headers.");
       return;
@@ -740,7 +740,7 @@
   return 0;
 }
 
-unsigned int cmELF::GetNumberOfSections() const
+std::size_t cmELF::GetNumberOfSections() const
 {
   if (this->Valid()) {
     return this->Internal->GetNumberOfSections();
diff --git a/Source/cmELF.h b/Source/cmELF.h
index 041b986..0528925 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -4,6 +4,7 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
+#include <cstddef>
 #include <cstdint>
 #include <iosfwd>
 #include <memory>
@@ -73,7 +74,7 @@
   std::uint16_t GetMachine() const;
 
   /** Get the number of ELF sections present.  */
-  unsigned int GetNumberOfSections() const;
+  std::size_t GetNumberOfSections() const;
 
   /** Get the position of a DYNAMIC section header entry.  Returns
       zero on error.  */