File: scitokens-cpp-fix-compilation-error-with-gcc-11.patch

package info (click to toggle)
scitokens-cpp 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,152 kB
  • sloc: cpp: 53,244; python: 7,418; sh: 319; makefile: 85
file content (35 lines) | stat: -rw-r--r-- 1,736 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 01b39dd8bef5fd23b48a71dea18ea6e6e3219f0e Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Mon, 7 Dec 2020 15:44:11 +0100
Subject: [PATCH] Fix compilation error with gcc 11

error: loop variable 'verification_pair' creates a copy from type 'const std::pair<bool (*)(const jwt::claim&, void*), void*>' [-Werror=range-loop-construct]
---
 src/scitokens_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/scitokens_internal.h b/src/scitokens_internal.h
index db10078..4977a07 100644
--- a/src/scitokens_internal.h
+++ b/src/scitokens_internal.h
@@ -390,7 +390,7 @@ public:
                  }
              }
              // std::cout << "Running claim " << claim_pair.first << " through validation." << std::endl;
-             if (iter != m_validators.end()) for (const auto verification_func : iter->second) {
+             if (iter != m_validators.end()) for (const auto &verification_func : iter->second) {
                  const jwt::claim &claim = jwt.get_payload_claim(claim_pair.first);
                  if (claim.get_type() != jwt::claim::type::string) {
                      std::stringstream ss;
@@ -409,7 +409,7 @@ public:
                      }
                  }
              }
-             if (iter_claim != m_claim_validators.end()) for (const auto verification_pair : iter_claim->second) {
+             if (iter_claim != m_claim_validators.end()) for (const auto &verification_pair : iter_claim->second) {
                  const jwt::claim &claim = jwt.get_payload_claim(claim_pair.first);
                  if (verification_pair.first(claim, verification_pair.second) == false) {
                      std::stringstream ss;
-- 
2.28.0