diff Plugin/AssociativeArray.cpp @ 62:222f0652025f

fix get argument values that were transformed to lowercase
author Alain Mazy <am@osimis.io>
date Wed, 16 Nov 2022 14:42:48 +0100
parents 914b8113fd46
children 1a13c4fbc9a1
line wrap: on
line diff
--- a/Plugin/AssociativeArray.cpp	Thu Nov 10 10:25:27 2022 +0100
+++ b/Plugin/AssociativeArray.cpp	Wed Nov 16 14:42:48 2022 +0100
@@ -25,23 +25,19 @@
   AssociativeArray::AssociativeArray(uint32_t headersCount,
                                      const char *const *headersKeys,
                                      const char *const *headersValues,
-                                     bool caseSensitive) :
-    caseSensitive_(caseSensitive)
+                                     bool caseSensitiveKeys) :
+    caseSensitiveKeys_(caseSensitiveKeys)
   {
     for (uint32_t i = 0; i < headersCount; i++)
     {
-      std::string value;
+      std::string key = headersKeys[i];
 
-      if (caseSensitive)
+      if (!caseSensitiveKeys)
       {
-        Orthanc::Toolbox::ToLowerCase(value, headersValues[i]);
-      }
-      else
-      {
-        value = headersValues[i];
+        Orthanc::Toolbox::ToLowerCase(key, headersKeys[i]);
       }
         
-      map_[headersKeys[i]] = value;
+      map_[headersKeys[i]] = headersValues[i];
     }
   }
 
@@ -56,7 +52,7 @@
 
     Map::const_iterator found;
 
-    if (caseSensitive_)
+    if (caseSensitiveKeys_)
     {
       found = map_.find(key);
     }