comparison 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
comparison
equal deleted inserted replaced
60:a2ed57d8a2f0 62:222f0652025f
23 namespace OrthancPlugins 23 namespace OrthancPlugins
24 { 24 {
25 AssociativeArray::AssociativeArray(uint32_t headersCount, 25 AssociativeArray::AssociativeArray(uint32_t headersCount,
26 const char *const *headersKeys, 26 const char *const *headersKeys,
27 const char *const *headersValues, 27 const char *const *headersValues,
28 bool caseSensitive) : 28 bool caseSensitiveKeys) :
29 caseSensitive_(caseSensitive) 29 caseSensitiveKeys_(caseSensitiveKeys)
30 { 30 {
31 for (uint32_t i = 0; i < headersCount; i++) 31 for (uint32_t i = 0; i < headersCount; i++)
32 { 32 {
33 std::string value; 33 std::string key = headersKeys[i];
34 34
35 if (caseSensitive) 35 if (!caseSensitiveKeys)
36 { 36 {
37 Orthanc::Toolbox::ToLowerCase(value, headersValues[i]); 37 Orthanc::Toolbox::ToLowerCase(key, headersKeys[i]);
38 }
39 else
40 {
41 value = headersValues[i];
42 } 38 }
43 39
44 map_[headersKeys[i]] = value; 40 map_[headersKeys[i]] = headersValues[i];
45 } 41 }
46 } 42 }
47 43
48 44
49 bool AssociativeArray::GetValue(std::string& value, 45 bool AssociativeArray::GetValue(std::string& value,
54 return false; 50 return false;
55 } 51 }
56 52
57 Map::const_iterator found; 53 Map::const_iterator found;
58 54
59 if (caseSensitive_) 55 if (caseSensitiveKeys_)
60 { 56 {
61 found = map_.find(key); 57 found = map_.find(key);
62 } 58 }
63 else 59 else
64 { 60 {