summaryrefslogtreecommitdiffstats
path: root/core/membuffer.h
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2020-02-14 11:49:28 -0800
committerGravatar Robert C. Helling <helling@atdotde.de>2020-02-15 10:12:35 +0100
commita9112e6e054d08a2a2af9eba167c3fdefb3f12c4 (patch)
tree1de3d0c653f2d3f8cc11118308951cadc0006817 /core/membuffer.h
parentf6260fff43acc5d4b010f3eb158c2b4533f27367 (diff)
downloadsubsurface-a9112e6e054d08a2a2af9eba167c3fdefb3f12c4.tar.gz
load-git: clean up string handling during parsing
We had some fairly obscure rules for how strings were parsed, and it actually caused bugs when the same line had multiple strings in it. That normally doesn't happen, and the cases where it was _supposed_ to happen had special cases for it (divecomputer ID lines, and tag lines). But by mistake, we had introduced a case of that for the event line handling in commit b9174332d ("Read and write divemode changes (xml and git)"), and nobody realized that the divemode string addition meant that "oops, now it's corrupting the event name". An event line could look like this: event 40:00 type=8 divemode="OC" name="modechange" where we now had both that "OC" and "modechange" strings, and the code to pick the name just picked the first string. So we'd end up effectively mis-parsing the above line as event 40:00 type=8 divemode="OC" name="OC" which is obviously wrong. The dive mode didn't really need to be a string in the first place (there is nothing to quote, and no spaces in it), but hey, here we are. We can't just magially fix the existing broken saves. So make it more straightforward to handle strings in the git format line parser. We still stash the different decoded strings together in one special memory buffer, but now the parser helpers automatically untangle it as they traverse the key value pairs. This is still overly subtle code, and it doesn't fix the cases where we've saved the wrong data back. That comes later. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/membuffer.h')
0 files changed, 0 insertions, 0 deletions