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/include/sessions.hpp b/include/sessions.hpp
index 2900cd5..b183a0e 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -362,22 +362,22 @@
// https://www.owasp.org/index.php/Session_Management_Cheat_Sheet#Session_ID_Entropy
std::string sessionToken;
sessionToken.resize(20, '0');
- std::uniform_int_distribution<int> dist(0, alphanum.size() - 1);
- for (int i = 0; i < sessionToken.size(); ++i)
+ std::uniform_int_distribution<size_t> dist(0, alphanum.size() - 1);
+ for (size_t i = 0; i < sessionToken.size(); ++i)
{
sessionToken[i] = alphanum[dist(rd)];
}
// Only need csrf tokens for cookie based auth, token doesn't matter
std::string csrfToken;
csrfToken.resize(20, '0');
- for (int i = 0; i < csrfToken.size(); ++i)
+ for (size_t i = 0; i < csrfToken.size(); ++i)
{
csrfToken[i] = alphanum[dist(rd)];
}
std::string uniqueId;
uniqueId.resize(10, '0');
- for (int i = 0; i < uniqueId.size(); ++i)
+ for (size_t i = 0; i < uniqueId.size(); ++i)
{
uniqueId[i] = alphanum[dist(rd)];
}
@@ -449,7 +449,7 @@
{
return needWrite;
}
- int getTimeoutInSeconds() const
+ int64_t getTimeoutInSeconds() const
{
return std::chrono::seconds(timeoutInMinutes).count();
};