summaryrefslogtreecommitdiff
path: root/include/sessions.hpp
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2019-10-24 21:21:38 +0300
committerEd Tanous <ed@tanous.net>2020-08-24 19:51:50 +0300
commit0dfeda6235bde10e0aedd28ba166b9e49b074833 (patch)
treef10af4b212b1c701f6865ec34828927c1075c95e /include/sessions.hpp
parentd4d77e399526671076936e9d9dd879dad2d24a2f (diff)
downloadbmcweb-0dfeda6235bde10e0aedd28ba166b9e49b074833.tar.xz
Modernize; Move some apis to range based for loop
There were a couple places in code where we still use index based for loops. Move these to the more modern range based for loops. Tested: Needs testing. Changes made by clang-tidy. Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: I30bf6fae6b2540434d5c98900a8f6bd0c8f2be93
Diffstat (limited to 'include/sessions.hpp')
-rw-r--r--include/sessions.hpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/sessions.hpp b/include/sessions.hpp
index f0de8c9594..e745845d1b 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -233,9 +233,9 @@ class SessionStore
OpenSSLGenerator gen;
- for (size_t i = 0; i < sessionToken.size(); ++i)
+ for (char& sessionChar : sessionToken)
{
- sessionToken[i] = alphanum[dist(gen)];
+ sessionChar = alphanum[dist(gen)];
if (gen.error())
{
return nullptr;
@@ -244,9 +244,9 @@ class SessionStore
// Only need csrf tokens for cookie based auth, token doesn't matter
std::string csrfToken;
csrfToken.resize(sessionTokenSize, '0');
- for (size_t i = 0; i < csrfToken.size(); ++i)
+ for (char& csrfChar : csrfToken)
{
- csrfToken[i] = alphanum[dist(gen)];
+ csrfChar = alphanum[dist(gen)];
if (gen.error())
{
return nullptr;
@@ -255,9 +255,9 @@ class SessionStore
std::string uniqueId;
uniqueId.resize(10, '0');
- for (size_t i = 0; i < uniqueId.size(); ++i)
+ for (char& uidChar : uniqueId)
{
- uniqueId[i] = alphanum[dist(gen)];
+ uidChar = alphanum[dist(gen)];
if (gen.error())
{
return nullptr;