summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'property_service/libpropertyinfoparser/property_info_parser.cpp')
-rw-r--r--property_service/libpropertyinfoparser/property_info_parser.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/property_service/libpropertyinfoparser/property_info_parser.cpp b/property_service/libpropertyinfoparser/property_info_parser.cpp
index e53c6253e..a8f663624 100644
--- a/property_service/libpropertyinfoparser/property_info_parser.cpp
+++ b/property_service/libpropertyinfoparser/property_info_parser.cpp
@@ -96,8 +96,12 @@ void PropertyInfoArea::CheckPrefixMatch(const char* remaining_name, const TrieNo
96 if (prefix_len > remaining_name_size) continue; 96 if (prefix_len > remaining_name_size) continue;
97 97
98 if (!strncmp(c_string(trie_node.prefix(i)->name_offset), remaining_name, prefix_len)) { 98 if (!strncmp(c_string(trie_node.prefix(i)->name_offset), remaining_name, prefix_len)) {
99 *context_index = trie_node.prefix(i)->context_index; 99 if (trie_node.prefix(i)->context_index != ~0u) {
100 *schema_index = trie_node.prefix(i)->schema_index; 100 *context_index = trie_node.prefix(i)->context_index;
101 }
102 if (trie_node.prefix(i)->schema_index != ~0u) {
103 *schema_index = trie_node.prefix(i)->schema_index;
104 }
101 return; 105 return;
102 } 106 }
103 } 107 }
@@ -142,8 +146,20 @@ void PropertyInfoArea::GetPropertyInfoIndexes(const char* name, uint32_t* contex
142 // Check exact matches 146 // Check exact matches
143 for (uint32_t i = 0; i < trie_node.num_exact_matches(); ++i) { 147 for (uint32_t i = 0; i < trie_node.num_exact_matches(); ++i) {
144 if (!strcmp(c_string(trie_node.exact_match(i)->name_offset), remaining_name)) { 148 if (!strcmp(c_string(trie_node.exact_match(i)->name_offset), remaining_name)) {
145 if (context_index != nullptr) *context_index = trie_node.exact_match(i)->context_index; 149 if (context_index != nullptr) {
146 if (schema_index != nullptr) *schema_index = trie_node.exact_match(i)->schema_index; 150 if (trie_node.exact_match(i)->context_index != ~0u) {
151 *context_index = trie_node.exact_match(i)->context_index;
152 } else {
153 *context_index = return_context_index;
154 }
155 }
156 if (schema_index != nullptr) {
157 if (trie_node.exact_match(i)->schema_index != ~0u) {
158 *schema_index = trie_node.exact_match(i)->schema_index;
159 } else {
160 *schema_index = return_schema_index;
161 }
162 }
147 return; 163 return;
148 } 164 }
149 } 165 }