mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Filter: Fix Loading of Negated Conditions from git.
Fix loading of the negation of filter conditions. Unlike other conditions that are persisted as `<key>="<value>"`, this is persisted to git as `negate`. This fix remediates this for all cases where the condition has already been saved to the cloud storage. Saving to XML takes a different approach and indicates negated conditions with `negate="1"`, making it identical to all other attributes. The question is if this approach should be implemented in addition to the above fix, in order to unify the storage format. Fixes #4246. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
b126fccb1b
commit
31fca0f676
1 changed files with 17 additions and 13 deletions
|
@ -357,23 +357,27 @@ static char *parse_keyvalue_entry(void (*fn)(void *, const char *, const std::st
|
|||
line++;
|
||||
}
|
||||
|
||||
if (c == '=')
|
||||
if (c != 0)
|
||||
*line++ = 0;
|
||||
|
||||
char *start_val = line;
|
||||
while ((c = *line) != 0) {
|
||||
if (isspace(c))
|
||||
break;
|
||||
line++;
|
||||
std::string val;
|
||||
if (c == '=') {
|
||||
const char *start_val = line;
|
||||
while ((c = *line) != 0) {
|
||||
if (isspace(c))
|
||||
break;
|
||||
line++;
|
||||
}
|
||||
|
||||
/* Did we get a string? Take it from the list of strings */
|
||||
val = start_val[0] == '"' ? pop_cstring(state, key)
|
||||
: std::string(start_val, line - start_val);
|
||||
|
||||
if (c)
|
||||
line++;
|
||||
|
||||
}
|
||||
|
||||
/* Did we get a string? Take it from the list of strings */
|
||||
std::string val = start_val[0] == '"' ? pop_cstring(state, key)
|
||||
: std::string(start_val, line - start_val);
|
||||
|
||||
if (c)
|
||||
line++;
|
||||
|
||||
fn(fndata, key, val);
|
||||
return line;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue