Fix a bunch of warnings
using the list of warnings from here:
https://github.com/lefticus/cppbestpractices/blob/e73393f25a85f83fed7399d8b65cb117d00b2231/02-Use_the_Tools_Available.md#L100
Seems like a good place to start, and would improve things a bit
type-wise. This patchset attempts to correct all the issues in one
shot.
Tested:
It builds. Will test various subsystems that have been touched
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Change-Id: I588c26440e5a97f718a0f0ea74cc84107d53aa1e
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index ec6e6a5..09fa05a 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -38,10 +38,10 @@
"Login", "ConfigureManager", "ConfigureComponents", "ConfigureSelf",
"ConfigureUsers"};
-constexpr const int basePrivilegeCount = basePrivileges.size();
+constexpr const size_t basePrivilegeCount = basePrivileges.size();
/** @brief Max number of privileges per type */
-constexpr const int maxPrivilegeCount = 32;
+constexpr const size_t maxPrivilegeCount = 32;
/** @brief A vector of all privilege names and their indexes */
static const std::vector<std::string> privilegeNames{basePrivileges.begin(),
@@ -100,7 +100,7 @@
*/
bool setSinglePrivilege(const char* privilege)
{
- for (int searchIndex = 0; searchIndex < privilegeNames.size();
+ for (size_t searchIndex = 0; searchIndex < privilegeNames.size();
searchIndex++)
{
if (privilege == privilegeNames[searchIndex])
@@ -140,8 +140,8 @@
{
std::vector<const std::string*> activePrivileges;
- int searchIndex = 0;
- int endIndex = basePrivilegeCount;
+ size_t searchIndex = 0;
+ size_t endIndex = basePrivilegeCount;
if (type == PrivilegeType::OEM)
{
searchIndex = basePrivilegeCount - 1;