Change variable scopes

cppcheck correctly notes that a lot of our variables can be declared at
more specific scopes, and in every case, it seems to be correct.

Tested: Redfish service validator passes.  Unit test coverage on others.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia4414410d0e8f74a3bd40fdc0e0232450d1a6416
diff --git a/include/http_utility.hpp b/include/http_utility.hpp
index cd1be3e..e1a8e2a 100644
--- a/include/http_utility.hpp
+++ b/include/http_utility.hpp
@@ -44,11 +44,10 @@
 inline ContentType getPreferedContentType(std::string_view header,
                                           std::span<ContentType> preferedOrder)
 {
-    size_t index = 0;
     size_t lastIndex = 0;
     while (lastIndex < header.size() + 1)
     {
-        index = header.find(',', lastIndex);
+        size_t index = header.find(',', lastIndex);
         if (index == std::string_view::npos)
         {
             index = header.size();